简体   繁体   中英

wordpress subfolder url htaccess

I am trying to create folder on my site which is named demo

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

but i want it so it looks like demo.mysite.com/afile.html

i have edited the htaccess file that was already created by wordpress

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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