dongzhi6087 2019-06-14 12:40
浏览 114

如何将我的子域名在htaccess文件中指向WordPress index.php所在的目录?

I'm trying to set up multilingual WordPress site using the PolyLang plugin. My website will have 3 languages - Ukrainian, Russian and English. Ukrainian default.

In the URL settings of polylang, there is an option to select a language by subdomain. The idea is that the URLs looks like this: “example.com” - is the default Ukrainian language main page of the site. “ru.example.com” - is Russian language, and “en.example.com” is English.

On the hosting, I have already created two subdomains ru and en. In the server root directory, there are 2 folders with the appropriate names. My question is whether it is possible and how to configure the .htaccess file like this: when a visitor gets to the subdomain page - the server returns not the file in the corresponding folder, but the index.php file located in the root.

I have already tried to do this:

RewriteCond %{HTTP_HOST} ^ru\.example\.com  [NC]
RewriteRule . /index.php [P]

And that's not worked. Not any results, just like nothing changed.

Here is full .htaccess file from the root:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^ru\.example\.com  [NC]
RewriteRule . /index.php [P]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Maybe I need to create and write .htaccess files in subdomain folders...

Thanks for any suggestions!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大