0

我有我的网址以这种方式

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 表达式?感谢您提前提供帮助

4

1 回答 1

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>

请告诉我它是否适合你!

于 2012-11-17T20:40:41.720 回答