regex - .htaccess regular expression need to make trailing forward slash optional -


I need to include an alternate follow-up forwards in my RewriteRule, that is a /,

I What is so far

  RewriteRule ^ ([one-zA-Z0-9] +) $ u.php $ 1 |? $ 2  

Which works fine, for example, to redirect and handle any query string parameters that might exist.

I (with the follower forwardslash) is taking and

So, if you have to redirect to your current, I would like to remove the last forward slash from $ 1 in my revised Raoul I need to do this? I'm new to Apache and have tried several different regex rules, but it can not get right.

just put / $ in your pattern First of all:

  RewriteRule ^ ([one-zA-Z0-9] +) /? $ U.php? $ 1  

But I suggest you allow only one spelling (with or without slash) and redirect to another:

 Slash RewriteCond% {REQUEST_FILENAME} after removing  # -d RewriteRule (. *) / $ / $ 1 [L, R = 301] # Adding trailing slash RewriteCond% {REQUEST_FILENAME}! -f RewriteRule * [^ /] $ / $ 0 / [L, R = 301]  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -