amwd07 Posted May 2, 2008 Share Posted May 2, 2008 Please can some one help me to combine these rules & get them to work together? Options +FollowSymLinks RewriteEngine on #Removes trailing slash from URL #RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] RewriteRule ^([^.]+)$ /dynamic.php?feature=$1 [L] #RewriteRule ^([^.]+)/([^.]+)$ /dynamic.php?feature=$1§ion=$2 [L] First question is how do I get the last 2 RewiteRules to work together. currently it only works with one query if I uncomment the 2nd that also works but disables the first? Even if I can get the above to work correctly by removing the trailing slash above the rule below fails RewriteRule ^dining/([^.]+)-([^.]+)\.php$ dining.php?county=$1&town=$2 [L] I can't win anyone any idea's? Quote Link to comment https://forums.phpfreaks.com/topic/103943-combine-htaccess-rules/ Share on other sites More sharing options...
amwd07 Posted May 3, 2008 Author Share Posted May 3, 2008 I have been looking through this topic & thought i had come up with the solution below but still pulling my hair out with this one ??? Options +FollowSymLinks RewriteEngine on #Removes trailing slash from URL RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] RewriteRule ^([^.]+)$ /dynamic.php?feature=$1 [L] #RewriteRule ^([^.]+)/([^.]+)$ /dynamic.php?feature=$1§ion=$2 [L] ////// Now the directory below needs to work off a spearte rule, but he above still effects this //// I thought the RewriteCond would seperate them not sure if i need to use [OR] somewhere? # Force trailing slash on directories (This only works if I take out the RewriteCond above?) RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ [R,L] RewriteRule ^dining/([^.]+)-([^.]+)\.php$ dining.php?county=$1&town=$2 [L] Quote Link to comment https://forums.phpfreaks.com/topic/103943-combine-htaccess-rules/#findComment-532329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.