漂亮的网址索引页面

时间:2014-04-14 22:55:53

标签: .htaccess url mod-rewrite url-rewriting

我只有第一个漂亮网址正常工作。我没有得到第二和第三个工作,他们只是显示一个混乱的页面(样式未加载)+它显示错误的页面

这是我的代码:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*)$ index.php?tab=$1 [NC]
RewriteRule ^/ucp(.*)$ index.php?ucp&tab=$1 [NC]
RewriteRule ^/ucp(.*)$ index.php?ucp [NC,L]

Possible urls:
http://subdomain.domain.com/path2files/index.php?&tab=str
http://subdomain.domain.com/path2files/index.php?ucp
http://subdomain.domain.com/path2files/index.php?ucp&tab=str

How they should look like:
http://subdomain.domain.com/path2files/str
http://subdomain.domain.com/path2files/ucp
http://subdomain.domain.com/path2files/ucp/str

1 个答案:

答案 0 :(得分:0)

试试这个:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /path2files/index\.php\?ucp&tab=(.*)\ HTTP
RewriteRule ^ /path2files/ucp/%2\? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^path2files/ucp/(.*)$ /path2files/index.php?ucp&tab=$1 [L]


RewriteCond %{THE_REQUEST} ^(GET|POST)\ /path2files/index\.php\?ucp\ HTTP
RewriteRule ^ /path2files/ucp\? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^path2files/ucp$ /path2files/index.php?ucp [L]

RewriteCond %{THE_REQUEST} ^(GET|POST)\ /path2files/index\.php\?&tab=(.*)\ HTTP
RewriteRule ^ /path2files/%2\? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/ucp
RewriteRule ^path2files/(.*)$ /path2files/index.php?&tab=$1 [L]
相关问题