mod rewrite - Apache的mod_rewrite在循环



我有两种URL:

  1. http://www.mydomain.com/Admin/Cpanel
  2. http://www.mydomain/Admin/shared/css/somestyle.css

1是对index.php的命令,2是一个实际文件

我需要mod_rewrite请求1/MyApp/index.php我需要mod_rewrite请求2/MyApp/shared/css/somestyle.css

/我有一个.htaccess文件与RewriteEngine On

RewriteCond ^MyApp/%{REQUEST_FILENAME} -f
RewriteRule ^MyApp/([^/]*)/(.*)?$ /MyApp/$1/$2 [L,QSA]
RewriteCond ^MyApp/%{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)/?$ /MyApp/index.php [L,QSA]

mod_rewrite似乎进入了一个循环。

我相信答案很简单,但是我一天之后…我还是不明白我哪里做错了

试试这个:

RewriteEngine On
RewriteRule ^/Admin/Cpanel$ /MyApp/index.php [L]
RewriteRule ^/Admin/(.*)$ /MyApp/$1

最新更新