Rewrite Rules Affecting 301 Redirect

Discuss practical ways rearrange URLs using mod_rewrite.

Rewrite Rules Affecting 301 Redirect

Postby guyguy » Fri Dec 12, 2008 3:16 am

The problem I am having is that I cannot seem to do a redirect in the htaccess file without the other rewrite rules affecting it. The below redirect ends up giving url ... tion=12/67
not just the redirect url
Is there a way to filter a specific url from the rewrite rules or something?

# -- shop re-writes - id only
RewriteRule ^trolleyed/([0-9\/]+)/sub_([0-9]+).htm$ /includes/shop.cgi?section=$1&page=$2 [L]
RewriteRule ^trolleyed/([0-9\/]+)/index.htm$ /includes/shop.cgi?section=$1 [L]
RewriteRule ^trolleyed/([0-9\/]+)$ /includes/shop.cgi?section=$1 [L]
Redirect trolleyed/12/67/
Posts: 1
Joined: Fri Dec 12, 2008 3:10 am

Postby richardk » Sat Dec 13, 2008 9:16 am

Redirect with mod_rewrite
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^trolleyed/12/67/?$ /trolleyed/customfolder/? [R=301,L]

RewriteRule ^trolleyed/([0-9/]+)/sub_([0-9]+)\.htm$ /includes/shop.cgi?section=$1&page=$2 [L]
RewriteRule ^trolleyed/([0-9/]+)(/(index\.htm)?)?$  /includes/shop.cgi?section=$1         [L]
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest