两个WordPress - 主要在root,dev文件在子文件夹中

时间:2011-09-14 15:15:23

标签: wordpress .htaccess mod-rewrite

我有一个使用Wordpress的主站点,该站点设置在域的根目录。

我基本上希望在子文件夹中拥有相同WordPress(使用副本数据库)的DEV版本,例如/ dev /

我得到的问题是,当我尝试访问开发版本时,root用户的主要WordPress似乎陷阱请求(htaccess?)并给出“未找到”页面。

这是我在root的htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

# MultiLingual domain
RewriteCond %{HTTP_HOST} ^(www.)?domain-other-language\.com*    [OR]
RewriteCond %{HTTP_HOST} ^(www.)?domain-other-language2\.com*
RewriteRule (.*) http://www.main-domain.com/$1?lang=en [R=permanent,L]

# Alternate domain
RewriteCond %{HTTP_HOST} ^(www.)?other-domain\.com*
RewriteRule (.*) http://www.main-domain.com/$1 [R=permanent,L]

# this doesn't seem to work
RewriteRule ^dev/$ - [PT,L]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

1 个答案:

答案 0 :(得分:0)

尝试

# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# MultiLingual domain
RewriteCond %{HTTP_HOST} ^(www.)?domain-other-language\.com*    [OR]
RewriteCond %{HTTP_HOST} ^(www.)?domain-other-language2\.com*
RewriteRule (.*) http://www.main-domain.com/$1?lang=en [R=permanent,L]

# Alternate domain
RewriteCond %{HTTP_HOST} ^(www.)?other-domain\.com*
RewriteRule (.*) http://www.main-domain.com/$1 [R=permanent,L]

RewriteCond %{REQUEST_URI} ^dev/
RewriteRule ^dev/.*$ - [PT]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./ /index.php [L]
</IfModule>
# END WordPress