[英]htaccess access subdomain subfolders
I've created a subdomain blog.example.co.uk
to point to a folder /blog in my root directory.. The folder blog has a subfolder /php which contain scripts that talk to my server eg login, logout. 我已经创建了一个子域
blog.example.co.uk
指向我的根目录中的文件夹/ blog。文件夹blog有一个/ php子文件夹,其中包含与我的服务器通信的脚本,例如登录,注销。 This is my current structure; 这是我目前的结构;
root --> /blog --> /php 根-> / blog-> / php
This is the rule that creates my subdomain 这是创建我的子域的规则
### Blog subdomain
RewriteCond %{HTTP_HOST} ^blog\.example\.co.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/blog/ [NC]
RewriteRule ^(.*)$ /blog/$1 [L]
The problem now is that files in /blog folder can't see files in /php. 现在的问题是/ blog文件夹中的文件看不到/ php中的文件。 I also get a file not found when I try the below;
当我尝试以下操作时,我还会得到找不到的文件;
http://blog.example.co.uk/php/login.php
How can I expose these files and be able to access them with the link above. 如何公开这些文件,并能够通过上面的链接访问它们。 I know I have to create a new rule just don't know how.
我知道我必须创建一条新规则,只是不知道怎么做。
To access the scripts I have to point to below; 要访问这些脚本,我必须指向以下内容:
http://blog.example.co.uk/blog/php/login.php
I also want to exclude the php folder from any rewrites, I'm using the below but it doesn't work for the folder; 我也想从任何重写中排除php文件夹,我正在使用以下内容,但不适用于该文件夹;
RewriteRule ^(/blog/php)($|/) - [L]
Try this .htaccss 试试这个.htaccss
RewriteEngine on
RewriteCond $1
!^(index\.php|images|robots\.txt|css|js|font|woff|ttf|svg|eot|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.