我有这样的网址
http://127.0.0.1:420/github/myproject/users
我的.htacess文件包含以下代码
<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on
RewriteBase /github/myproject
RewriteCond $1 !^(index\.php|images|style|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>
你能帮助我如何编写适合我的网址的RewriteRule表达式吗?谢谢你提前帮助
答案 0 :(得分:0)
只需将此行添加到顶部:
RewriteRule ^/github/myproject/(.*)$ /github/myproject/index.php/$1 [NC]
所以它会变成:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/github/myproject/(.*)$ /github/myproject/index.php/$1 [NC]
DirectoryIndex index.php
RewriteBase /github/myproject
RewriteCond $1 !^(index\.php|images|style|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>
请告诉我它是否适合您!