使用apache2.conf进行PHP和重定向
我有一个内部域,比如 live.domain.com 这是我在网站上定义的使用apache2.conf进行PHP和重定向,php,apache,url-rewriting,Php,Apache,Url Rewriting,我有一个内部域,比如 live.domain.com 这是我在网站上定义的 ServerName live.domain.com ServerAdmin webmaster@localhost DocumentRoot /data/www/html/mydomainnamenodots <Directory /data/www/html/mydomainnamenodots> Require all granted
ServerName live.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /data/www/html/mydomainnamenodots
<Directory /data/www/html/mydomainnamenodots>
Require all granted
</Directory>
你知道为什么这样不行吗?
我是错过了基地还是什么
提前谢谢
Alex由于子域已指向子文件夹,因此它必须是目录定义中该子文件夹下方的相应子文件夹。此外,我还更改了regexp 以下是对我有效的方法:
<Directory />
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*\/api(\/.*)$ /api/index.php?url=\/$1 [QSA,L]
</Directory>
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写规则^.*\/api(\/.*)$/api/index.php?url=\/$1[QSA,L]
重写规则
与请求URL的路径组件匹配。您请求的URL路径中不包含MyDomainNameNodeots
。确定-我将其更改为RewriteRule^.*?api(.*)/api/index.php?URL=$1[QSA,L]
获取未找到请求的URL/api/statistics/getFTE/9936514/131331在此服务器上未找到。
有什么想法吗?为什么*?
开始时,如果要匹配的内容以/api/
?//请尝试将其从您当前所在的目录
容器中取出,但不确定是否与开头匹配。取消注释部分会导致相同的错误。但也许我没有正确理解你的观点。你介意改变我的规则来反映你的建议吗?!
<Directory />
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*\/api(\/.*)$ /api/index.php?url=\/$1 [QSA,L]
</Directory>