htaccess的面膜我的网址 [英] htaccess mask for my url
问题描述
我想使用的.htaccess来掩盖我的网址的一部分,但我有几个问题。
I'm trying to mask a part of my url using .htaccess but I'm having several issues
我的网址是 http://ristorantitalianetwork.com/ristorantitalianetwork.com/admin/
我想删除重复ristorantitalianetwork.com,所以我想我的网址会像
I'd like to remove the duplicate ristorantitalianetwork.com, so I'd like that my url will be like
http://ristorantitalianetwork.com/admin/
我用
RewriteRule ^ristorantitalianetwork.com/([^/]*)$ ?q=$1 [L]
,但它不工作
but it doesn't work
能否请你帮我弄清楚如何解决这个问题?
Could you please help me to figure out how to solve this problem?
多谢
最好的问候
推荐答案
您几乎做到了!但是......
You almost did it! But...
在你的问题,你的重写规则说,它适用于那些不以斜杠结尾的URL( /
)。你说你要重写一些网址...,并给网址的例子以斜杠( /
)。
In your question, your rewriterule says that it is applied on URLs that don't end with a slash (/
). And you say you want to rewrite some URLs... and give URLs examples with a slash (/
).
如果您需要做的真正的重定向(即在浏览器中修改URL):,这里的好重写规则:
If you need to do a real redirect (i.e. the URL in the browser changes):, here's the good rewriterule:
RewriteRule ^ristorantitalianetwork\.com/([^/]*)/$ /$1 [QSA,R=301,L]
如果你需要做的只是内部重定向:
If you need to do only internal redirect:
RewriteRule ^ristorantitalianetwork\.com/([^/]*)/$ /$1 [QSA,L]
请记住,网址必须结尾加上一个斜线( /
)。
Keep in mind that the URL must end with a slash (/
).
这篇关于htaccess的面膜我的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!