I have the following rewrite rules in my .htaccess
file:
RewriteEngine on
RewriteRule ^news/([0-9]+)/?$ /?action=news&start=$1 [L]
RewriteRule ^man/([a-zA-Z0-9_]+)/?$ /?action=man&page=$1 [L]
RewriteRule ^([a-zA-Z0-9_]+)/?$ /?action=$1 [L]
All of then end with a /?
to check for an optional trailing slash. This works - it means I can use either http://www.site.com/news/
or http://www.site.com/news
to get to the news
page, which is what I want. The problem is that, while http://www.site.com/news/
works fine and redirects silently and all that fun stuff, http://www.site.com/news
is visibly redirected to http://www.site.com/news/?action=news
for some reason. They both come up with the same site, but for some reason if I leave off the trailing slash, the URL changes and looks all nasty.
Any ideas what's going on with this? I have no other rules in my .hyaccess
file. I'll also point out that http://www.site.com/news/0
and http://www.site.com/news/0/
do not suffer from the same problem. Both of them redirect invisibly to http://www.site.com/?action=news&start=0
, which is what I want. It only seems to be a problem with that third rule.
If it helps any, the site is on SourceForge.net.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…