我网站上的网址结构如下:http://www.mydomain.tld/index.php/pages/sitename
。现在我要删除index.php/pages
,让网址结构与http://www.mydomain.tld/sitename
类似。此外,我想重命名一些sitename
的个人。
我已经删除了index.php,这没问题。所以目前我的.htacces-File看起来像
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico|pam)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^mydomain.tld\.de$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.tld/$1 [R=301,L]
但如果我将/pages
追加到第一个RewriteCond或RewriteRule,它就不起作用了。
你有什么想法吗?
答案 0 :(得分:0)
让你的.htaccess像这样:
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.tld\.de$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.tld/$1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!index\.php/pages/).*)$ index.php/pages/$1 [NC,L]