Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove subfolder from WordPress URL using htaccess

I've moved WordPress into it's own directory as per the instruction found on the WordPress support site.

I've got his working fine but the URL now shows http://www.example.com/subfolder/ but I want it to show without the /subfolder/

I can't seem to get the htaccess to remove the /subfolder/

Here's my current htaccess code

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ subfolder [L]
like image 821
Walshie1987 Avatar asked Nov 01 '22 03:11

Walshie1987


1 Answers

This should change http://www.mysite.com/subfolder/ to http://www.mysite.com/

RewriteEngine On
RewriteRule ^/subfolder/(.*)$ http://www.mysite.com/$1 [L,R=301]
like image 156
Howli Avatar answered Nov 15 '22 17:11

Howli