mod_rewrite +访问
我有一个 (Joomla) 站点当前未指向域,但直接位于我的服务器 IP 上(即: http ://176.158.165.1/~sitename)
每当我尝试测试 mod_rewrite 时,都会收到 404 错误。我已经在同一服务器上的另一个站点上进行了测试,但它可以 100% 工作。这个问题是否是由于直接链接到 IP 地址造成的?
我的 .htaccess 文件如下:
RewriteEngine On
Options +FollowSymLinks
Redirect /google.html http://www.google.com
谢谢,
Dev
I have a (Joomla) site that is not currently pointing to a domain, but is sitting directly on my server IP (i.e.: http://176.158.165.1/~sitename)
Whenever I try to test my mod_rewrite, I get 404 errors. I have tested on another site on the same server, but it works 100%. Could this problem be due to the direct link to the IP address?
My .htaccess file is as follows:
RewriteEngine On
Options +FollowSymLinks
Redirect /google.html http://www.google.com
Thanks,
Dev
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
尝试 #2:(使用 mod_rewrite)
try:
Try #2: (using mod_rewrite)
在子目录中工作时,无论 htaccess 文件放置在哪里,您都需要添加目录名称:
您也可以使用 RewriteBase 但说实话,我从来没有真正弄清楚如何让它工作,而我却懒得去整理它。
When working in a subdirectory, you need to add the directory name regardless where the htaccess file is placed:
you can also use
RewriteBase
but to be totally honest, I never really figured out how to get that working, and I've been too lazy to sort it out.