Jump to content

Recommended Posts

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&section=$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?

Link to comment
https://forums.phpfreaks.com/topic/103943-combine-htaccess-rules/
Share on other sites

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&section=$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]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.