5

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]

2 Answers 2

2

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]
Sign up to request clarification or add additional context in comments.

1 Comment

Curious, if you "added an addtional "/" at the front of subfolder" (ie. at the front of the RewriteRule pattern) then it would never have worked in a directory/.htaccess context (as stated in the question). (?) The slash prefix would only be required in a server or virtualhost context?!
0

For future reference: I think the answer provided by Hareesh Sivasubramanian is better:

I advice you against messing up the contents of the .htaccess file. Revert the changes that you've made to this file and follow the simple procedue.
1. Login to the admin dashboard.
2. Go to Settings > General
3. In the WordPress Address (URL) field type http://www.example.com/site
4. In the Site Address (URL) field type http://www.example.com
Save the changes and you should be good to go.

(https://stackoverflow.com/a/37346685/1334353)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.