mod_rewrite

[font=lucida grande]I’ve got Wordpress set up and I’m using the permalinks fine but want to also add an extra clause to the .htaccess to check whether the url is /characters/[charname] and send it to /characters?char=[charname].
Current .htaccess:

[/font][code]

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^characters/([^/\.]+)/?$ /?page_id=89&char=$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

END WordPress[/code][font=lucida grande]

Issue is that when I try to access characters/userx it just redirects to characters/

I disabled permalinks temporarily and had the .htaccess as just:

[/font] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^characters/([^/\.]+)/?$ /?page_id=89&char=$1 </IfModule>[font=lucida grande]
And that worked with characters redirecting properly but would much rather prefer to have the entire site have friendly URLs.[/font]

[font=lucida grande]Any help would be greatly appreciated.

[/font]

You need to add [L] parameter, so that your .htaccess looks like below:

<IfModule mod_rewrite.c>
RewriteEngine  On
RewriteBase /
RewriteRule ^characters/([^/\.]+)/?$  /?page_id=89&char=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Tried every manner of flags for the .htaccess but to no avail. Got what I wanted using a slightly different method so it’s fine I guess.

Sponsor our Newsletter | Privacy Policy | Terms of Service