简体   繁体   English

WordPress的子文件夹URL htaccess

[英]wordpress subfolder url htaccess

I am trying to create folder on my site which is named demo 我正在尝试在我的网站上创建名为demo的文件夹

so www.mysite.com/demo/afile.html 因此www.mysite.com/demo/afile.html

but i want it so it looks like demo.mysite.com/afile.html 但我想要它,所以看起来像demo.mysite.com/afile.html

i have edited the htaccess file that was already created by wordpress 我已经编辑了已经由wordpress创建的htaccess文件

# 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]


RewriteCond %{HTTP_HOST} ^demo\.mysite\.com$
RewriteCond %{REQUEST_URI} !^/demo/
RewriteRule (.*) /demo/$1

</IfModule>

# END WordPress

But when i go to demo.mysite.com/afile.html its not found. 但是当我转到demo.mysite.com/afile.html时,找不到它。 What am i doing wrong 我究竟做错了什么

I think you have to create the subdomain demo.mysite.com that point to a folder with a .htaccess on it. 我认为您必须创建指向指向带有.htaccess文件夹的子域demo.mysite.com。

But in this case, you just have to choose the directory containing your demo site /path/to/mysite/demo as the DocumentRoot for the subdomain demo.mysite.com (and no need for rewrite rules) 但是在这种情况下,您只需要选择包含演示站点/ path / to / mysite / demo的目录作为子域demo.mysite.com的DocumentRoot(并且无需重写规则)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM