[英]rewrite everything to index.php in a subfolder
我的多明指出
public_html
我的index.php在
public_html/webroot/
我在public_html /中的.htaccess
RewriteEngine on
RewriteRule ^$ /webroot/ [L]
很好地重定向到index.php
现在,我想重定向
domain.com/one/two/three
至
domain.com/app/webroot/index.php?1=one&2=two$three=3
我尝试了几种组合,但无济于事。
你可以尝试像
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^1/?([^/.]+)/2/([^/.]+)/3/([^/.]+)$ index.php?1=$1&2=$2&3=$3 [L]
</IfModule>
我上面显示的示例在apache conf文件中。 我不确定.htaccess,但您也许可以将其翻译为.htaccess
谢谢
您可以在根.htaccess中使用以下代码:
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)(?:/([^/]+)(?:/([^/]+))?)?/?$ webroot/index.php?1=$1&2=$2&3=$3 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.