我想做一个简单的URL重写但不能成功......这就是我所拥有的:
我在同一主机上有3个网站。
www.websiteAAA.com - 常规网站,位于'/ website-AAA-folder'文件夹
www.websiteBBB.com - 常规网站,位于'/ website-BBB-folder'文件夹
www.websiteCCC-Wordpress.com - 一个Wordpress网站,位于'/ website-CCC-Wordpress-folder'文件夹
我命令将请求重定向到正确的域名,我在主目录中有一个.htaccess文件:
Options +SymLinksIfOwnerMatch AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
#redirect to the correct folder
RewriteCond %{HTTP_HOST} websiteAAA.com$ [NC]
RewriteCond %{REQUEST_URI} !^/website-AAA-folder/.*$
RewriteRule ^(.*)$ /website-AAA-folder/$1 [L]
#redirect to the correct folder
RewriteCond %{HTTP_HOST} websiteBBB.com$ [NC]
RewriteCond %{REQUEST_URI} !^/website-BBB-folder/.*$
RewriteRule ^(.*)$ /website-BBB-folder/$1 [L]
#redirect to the correct folder
RewriteCond %{HTTP_HOST} websiteCCC-Wordpress.com$ [NC]
RewriteCond %{REQUEST_URI} !^/website-CCC-Wordpress-folder/.*$
RewriteRule ^(.*)$ /website-AAA-folder/$1 [L]
在/ website-CCC-Wordpress-folder /(其中有wordpress网站),还有一个额外的.htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我想将www.websiteCCC-Wordpress.com/aaa/重新打造成www.websiteCCC-Wordpress.com/?id=2&someugleurl=e&blabla=1
我将此行添加到根文件夹中的.htaccess文件中:
RewriteRule ^(aaa)$ ?id=2&someugleurl=e&blabla=1 [L]
然而,这不起作用。
请建议。
由于
答案 0 :(得分:1)
想出来
你必须把行
RewriteRule ^(aaa)$ ?id=2&someugleurl=e&blabla=1 [L]
成为wordpress中htaccess文件的第一个
RewriteRule ^(aaa)$ ?id=2&someugleurl=e&blabla=1 [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>