Rewrite rule not working

If this address already gets traffic (from inbound links etc.) why don’t you try a good old fashioned redirect like this:

Redirect 301 /sca/project_0 http://www.yourdomain.com/sca?urn=project_0

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

Or use the 301 redirect in addition to your rewrite rule:

Redirect 301 /sca/project_0 http://www.yourdomain.com/sca?urn=project_0

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

Also note that WP is often deleting additional rewrite rules inside #Begin WordPress #End WordPress. And sometimes rewrite rules do not behave like they should in localhost.

Leave a Comment