在重写代码时遇到了一些问题。我想添加几个域(所有域都指向同一台服务器),并使其具有一个“隐藏”URL前缀被发送到服务器。
示例:输入example-one.org/contact,服务器将其视为/one/contact/
基于@anubhava答案的更新代码
使用此代码时,我仍然会收到一个500内部服务器错误。我让它通过一个htaccess测试仪,它看起来应该能工作。
以下是完整的htaccess代码,包括WordPress的默认值,并且不使用example.org:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^discoverdowntownspringfield.org$ [NC]
RewriteRule ^((?!downtown-springfield/).*)$ /downtown-springfield/$1 [L,NC]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress发布于 2014-06-30 19:35:14
您可以使用:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.org$ [NC]
RewriteRule ^((?!one/).*)$ /one/$1 [L,NC]https://stackoverflow.com/questions/24497590
复制相似问题