【发布时间】:2015-04-16 07:48:23
【问题描述】:
我正在尝试使用 .htaccess 和 wordpress 创建虚拟子域。 但它似乎无法正常工作。使用 wordpress 我得到如下网址: foo.eu/test-pagina/?lang=fr
我设法将其重写为我想要的: fr.foo.eu/test-pagina/
但是当这个 url 被重写时,页面返回 500 内部服务器错误。
我还在我的 dns 配置中为子域设置了通配符。
我必须为我的根目录中的每个子域创建子文件夹吗?
我当前的 .htaccess 代码是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^([a-z]{2})\.hypnose\.eu$ [NC]
RewriteCond %{THE_REQUEST} \ /+([^\?]*)\?lang=([a-z]{2})&?([^\ ]*)
#RewriteRule ^ http://%2.hypnose.eu/%1?%3 [L,R]
RewriteCond %{QUERY_STRING} !(^|&)lang=
RewriteCond %{HTTP_HOST} ^([a-z]{2})\.hypnose\.eu$ [NC]
RewriteRule ^(.*)$ /$1?lang=%1 [L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
谁能告诉我我做错了什么?
【问题讨论】:
标签: wordpress apache .htaccess mod-rewrite subdomain