• Hello friends!

    My permalink structure works fine.
    I have a page called “profile” and the permalink works with
    https://myurl.com/profile

    Now all i want to have the following integrated in my
    permalink structure:
    If somebody calls https://myurl.com/profile/david/
    he has to be “redirected” via mod_rewrite to
    https://myurl.com/profile/?username=david
    so that i can GET the parameter.

    I have to include it into my existing configuration:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    It would be very nice if you have some suggestions.

    Thank you VERY Much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You may try this in the .htaccess.

    redirect 301 /profile/david/ https://myurl.com/profile/?username=david

    Michael

    Thread Starter vielhuber

    (@vielhuber)

    Sorry, doesn’t work! Your suggestion seems to be to simple.

    I tried

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} profile/(.*)
    RewriteRule . /profilepage/?user=%1 [L,R=301]

    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    and now i am redirected correctly.
    /profilepage/ is a prepared page!

    The problem now: The new URL is shown in the adress bar.
    I only want the “fake” URL to be shown!
    If i remove the R=301, i get a 404
    (because it seems to interfer with the other rewrite rules!).

    Without redirect (works for me):

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule profile/(.*)/?$ index.php/profilepage/?user=$1 [L]
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalink Structure: Make an exception!!!’ is closed to new replies.