.htaccess 一个简单的htaccess重定向

.htaccess 一个简单的htaccess重定向,.htaccess,redirect,.htaccess,Redirect,我如何编写一个重定向规则,让我同时使用and而不是and 我想我很接近了,但出于某种原因,今天是星期一 RewriteRule ^(.*)/rss.\xml/$ $1/rss [L] 这是一个猜测,但看起来您想逃避,这是通过\而不是\完成的 RewriteRule ^(.*)/rss\.xml$ $1/rss [L] 这是一个猜测,但看起来您想逃避,这是通过\而不是\完成的 RewriteRule ^(.*)/rss\.xml$ $1/rss [L] 我想这就是你想要的(你把它们颠倒过来了

我如何编写一个重定向规则,让我同时使用and而不是and

我想我很接近了,但出于某种原因,今天是星期一

RewriteRule ^(.*)/rss.\xml/$ $1/rss [L]

这是一个猜测,但看起来您想逃避
,这是通过
\
而不是
\
完成的

RewriteRule ^(.*)/rss\.xml$ $1/rss [L]

这是一个猜测,但看起来您想逃避
,这是通过
\
而不是
\
完成的

RewriteRule ^(.*)/rss\.xml$ $1/rss [L]

我想这就是你想要的(你把它们颠倒过来了):


我想这就是你想要的(你把它们颠倒过来了):


听起来好像您有XML文件,并且希望使URI不使用XML扩展

# translate /rss to /rss.xml
RewriteRule ^rss$ /rss.xml 

# translate /anydirectory/rss to /anydirectory/rss.xml
RewriteRule ^(.+)/rss$ /$1/rss.xml 
您尝试的代码显示了相反的结果

# translate /rss.xml to /rss
RewriteRule ^rss\.xml$ /rss 

# translate /anydirectory/rss to /anydirectory/rss.xml
RewriteRule ^(.+)/rss\.xml$ /$1/rss 

听起来好像您有XML文件,并且希望使URI不使用XML扩展

# translate /rss to /rss.xml
RewriteRule ^rss$ /rss.xml 

# translate /anydirectory/rss to /anydirectory/rss.xml
RewriteRule ^(.+)/rss$ /$1/rss.xml 
您尝试的代码显示了相反的结果

# translate /rss.xml to /rss
RewriteRule ^rss\.xml$ /rss 

# translate /anydirectory/rss to /anydirectory/rss.xml
RewriteRule ^(.+)/rss\.xml$ /$1/rss 

很好,丹尼斯,谢谢你。我想逃避,但一定是打错了。更近了,但还是不太管用。很好,丹尼斯,谢谢。我想逃避,但一定是打错了。更近了,但还没完全起作用,@Sean和@Patrick在正确的轨道上吗?你想让site.com/rss重定向到site.com/rss.xml吗?是的,他们知道了。谢谢你的帮助,@Sean和@Patrick走对了吗?你想让site.com/rss重定向到site.com/rss.xml吗?是的,他们知道了。谢谢你的帮助。