我创建了一个子域,指向我的根目录下的文件夹,如下所示;
RewriteCond %{HTTP_HOST} ^blog\.example\.co.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/blog/ [NC]
RewriteRule ^(.*)$ /blog/$1 [L]
我现在可以像/blog
http://blog.example.co.uk/index.php
文件夹的文件了
/blog
文件夹包含一个包含脚本的/php
文件夹。
我无法访问此/php
http://blog.example.co.uk/php/test.php
文件夹
这不起作用。要我访问它们,我必须这样做http://www.example.co.uk/blog/php/test.php
以下是我当前的.htaccess
Options +FollowSymLinks -MultiViews
### Turn mod_rewrite on
RewriteEngine On
RewriteBase /
### Prevent rules on script folder in root /php & /blog/php because I remove .php extension from all files
RewriteRule ^(php|blog/php)($|/) - [L]
### To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
### To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
### My subdomain
RewriteCond %{HTTP_HOST} ^blog\.example\.co.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/blog/ [NC]
RewriteRule ^(.*)$ /blog/$1 [L]
现在我需要创建一个规则,将http://blog.example.co.uk/php
指向/blog/php
谢谢你们