PHP的.htaccess新的cPanel账户改写 [英] php .htaccess rewrite with new cpanel account

查看:110
本文介绍了PHP的.htaccess新的cPanel账户改写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的.htaccess文件,这是我对更清洁的URL经常做以下。有亲的和缺点,这我知道,我想我已经找到了一个骗子。

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

我有一个新的cPanel账户这个网页的网址是这样的:

I've up a new cPanel account for this website so the URL looks like this:

http://www.example.com/~newuser/

...其中example.com是我的经销商帐户和新用户是我的客户。

...where example.com is my reseller account and newuser is my client.

该网站加载罚款,但是当我点击一个链接 http://www.example.com/~newuser/about 我收到以下错误:

The site loads fine but when I click a link http://www.example.com/~newuser/about I get the following error:

所请求的网址   /home/newuser/public_html/about.php   在此服务器上找到。

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?

在此先感谢。

推荐答案

在你的的RewriteCond 线,添加​​的RewriteBase 像这样一行:

Before your RewriteCond lines, add a RewriteBase line like so:

RewriteEngine on
RewriteBase /~newuser/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options All -Indexes

这篇关于PHP的.htaccess新的cPanel账户改写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆