• Resolved jalet

    (@jalet)


    On my wordpress site a have a few pages. On one page i present the content depending on $_GET[‘ID’:
    http://www.schoolsout.se/site/hitta-studentskiva?eventID=0000000013

    I want the URL to be like this:
    http://www.schoolsout.se/site/hitta-studentskiva/0000000013.html

    But I can’t make it work. In the .htaccess I have added this line:

    RewriteEngine On
    RewriteRule ^site/hitta-studentskiva/([^/]*)\.html$ /site/hitta-studentskiva?eventID=$1 [L]

    So now it looks like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /site/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]
    </IfModule>
    
    # END WordPress
    
    RewriteEngine On
    RewriteRule ^site/hitta-studentskiva/([^/]*)\.html$ /site/hitta-studentskiva?eventID=$1 [L]

    I haven’t worked with mod rewrite earlier.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Jalet – you need to place your custom line above the code that WordPress generates. Basically, the WordPress code says “If the request is not actually a file or folder – send the request to index.php for processing”.

    Thread Starter jalet

    (@jalet)

    Ok, i tried like this, but it still wont work 🙁

    RewriteEngine On
    RewriteRule ^site/hitta-studentskiva/([^/]*)$ /site/hitta-studentskiva/?eventID=$1 [L]
    
    <IfModule mod_rewrite.c>
    #
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /site/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]
    </IfModule>
    
    # END WordPress

    Problem is most likely with your regex, maybe this will work?

    RewriteRule ^site/hitta-studentskiva/([0-9]{10})$ /site/hitta-studentskiva/?eventID=$1 [L]

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Permalink dynamic pages .htaccess’ is closed to new replies.