开发者

php .htaccess rewrite with new cpanel account

开发者 https://www.devze.com 2022-12-16 04:33 出处:网络
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.

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://开发者_JAVA百科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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消