Jump to content


Photo

mod_alias/mod_rewrite with slashes


  • Please log in to reply
No replies to this topic

#1 Alcedema

Alcedema
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 23 July 2003 - 09:07 PM

Ok, I am one step further with adding trailing slashes when the user misses them out. I have a set of rewrite mod lines which change the incoming address, but they gave a 404 if the user did not add a trailing slash.

So I started with redirectmatch lines. These work.

This is what I have:



RewriteEngine onRewriteRule ^([^/]*)/$  /home/nominis/public_html/dev/index.php?id=$1RewriteRule ^([^/]*)/([^/]*)/$  /home/nominis/public_html/dev/index.php?id=$1&id2=$2RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$  /home/nominis/public_html/dev/index.php?id=$1&id2=$2&id3=$3RedirectMatch ^/dev/([^/]*)$ http://www.nominis.net/dev/$1/RedirectMatch ^/dev/([^/]*)/([^/]*)$ http://www.nominis.net/dev/$1/$2/RedirectMatch ^/dev/([^/]*)/([^/]*)/([^/]*)$ http://www.nominis.net/dev/$1/$2/$3/

Now the redirectmatch works with 2 and 3 variables, but the first line, the one with one variable, doesn\'t work. Always gives \"index.php\" instead of the actual given variable. Also, the redirectmatch line with 2 variables, always puts 2 slashes on the end, instead of one. Is it going through two matches?

Anything someone can add?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users