1

I have website where all the files were in the public_html root so my urls were http://foo.com/index.php

I have moved all my files into a bar directory so now the url is: http://foo.com/bar/index.php however I would like to rewrite the URLs so that the the directory bar is not shown in the urls and the site still appears as http://foo.com/index.php. What is the best way of achieving this? I have LAMP hosting and can change htaccess files.

Thanks in advance.

1 Answer 1

2

Put this code in your .htaccess under public_html:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^((?!bar/).*)$ bar/$1 [NC,L]

Then you can access your website as http://foo.com/index.php

Sign up to request clarification or add additional context in comments.

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.