Reputation: 35
Two questions,
I just finished a site and it is about to go live.
It is saved in www.example.com/store/, and I want it to strictly open at the /store/, nowhere else since there are many other areas on that drive, so first off, for achieving this action;
would I simply put inside the htaccess;
Redirect 301 / http://www.example.com/store/
??
And continuing off that, say I have links on /store/index.php that link off to www.example.com/links/ which is outside the /store/ link.. would those now not work?
Thanks for the help guys!
Upvotes: 0
Views: 41
Reputation: 143906
You could also stay with mod_alias RedirectMatch
. The Redirect
directive also include sub-directories, so you're actually creating a loop when you redirect /
into a sub-directory. But RedirectMatch
won't:
RedirectMatch 301 ^/(?!store)(.*)$ /store/
Upvotes: 1
Reputation: 119
Also make sure to restrict access outside of that directory. So make only that directory available, and ban access to all others. Check this out for some help.
Upvotes: 0
Reputation: 13412
If you want all traffic be redirected to store/
, just do:
RewriteEngine on
RewriteCond %{REQUEST_URI} !/store/$
RewriteRule (.*) /store/ [R=301,L]
Now all traffic will redirect to the store/
.
Let me know if I could provide you with more details.
Upvotes: 1