mod_rewrite 的问题
我在让 .htaccess 按我想要的方式工作时遇到问题,我想知道是否有人可以阐明这一点。
这是我当前的设置:
我的共享托管站点可以通过 http://www20.a2hosting.com/ 访问~myname/
我希望访问其中的几个子目录。例如 http://www20.a2hosting.com/~myname/subdir/public/ index.php 工作得很好。
现在我试图将对我的子目录/公共的所有调用重定向到我的index.php,并且在这个程度上,我在我的子目录/公共中创建了一个 .htaccess 文件,如下所示:
RewriteEngine on
RewriteRule ^.*$ index.php
但是,当我将我的浏览器定向到 http://www20.a2hosting.com/~myname/subdir/public / 我收到以下 404 错误:
The requested URL /home/myname/public_html/subdir/public/index.php was not found on this server.
我做错了什么?
多谢!
I have a problem with getting my .htaccess to work like I want and I was wondering if anyone could shed a light on this.
Here is my current setup:
My shared hosting site can be accessed by http://www20.a2hosting.com/~myname/
I have several sub directories inside that I wish to access. For instance
http://www20.a2hosting.com/~myname/subdir/public/index.php works just fine.
Now I'm trying to get all the calls to my subdir/public be re-directed to my index.php and to that extent I've created a .htaccess file in my subdir/public that looks as following:
RewriteEngine on
RewriteRule ^.*$ index.php
However, when I direct my browser to http://www20.a2hosting.com/~myname/subdir/public/
I get the following 404 Error:
The requested URL /home/myname/public_html/subdir/public/index.php was not found on this server.
What am I doing wrong?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试指定绝对路径作为重写目标:
Try specifying an absolute path as the rewrite target: