使用新的 cpanel 帐户重写 php .htaccess
我的 .htaccess 文件中有以下内容,我经常这样做是为了更清晰的 URL。我知道这有优点也有缺点,而且我想我已经找到了缺点。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options All -Indexes
我为此网站建立了一个新的 cPanel 帐户,因此 URL 如下所示:
http://www.example.com/~newuser/
...其中 example.com 是我的经销商帐户,newuser 是我的客户。
该网站加载正常,但当我单击链接 http://www.example.com/~newuser/about
时,出现以下错误:
请求的URL /home/newuser/public_html/about.php 在此服务器上找不到。
问题是,这正是我想要显示的文件,即文档根目录。有什么想法吗?
提前致谢。
I have the following in my .htaccess file, which I do often for cleaner URL's. There are pro's and cons to this I know and I think I've found a con.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options All -Indexes
I've up a new cPanel account for this website so the URL looks like this:
http://www.example.com/~newuser/
...where example.com is my reseller account and newuser is my client.
The site loads fine but when I click a link http://www.example.com/~newuser/about
I get the following error:
The requested URL
/home/newuser/public_html/about.php
was not found on this server.
The problem is, that's exactly the file I want it to display and that is the document root. Any ideas?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
RewriteCond
行之前,添加RewriteBase
行,如下所示:Before your
RewriteCond
lines, add aRewriteBase
line like so: