apache - .htaccess - silently rewrite/redirect everything to internal subfolder -
let's have thiswww.example.com
site structure:
/srv/http/ /srv/http/site/index.php /srv/http/site/stuff.php
i want next rewrites/redirects happen:
www.example.com/index.php
-> redirects -> www.example.com/site/index.php
-> user sees -> www.example.com/index.php
www.example.com/stuff.php
-> redirects -> www.example.com/site/stuff.php
-> user sees -> www.example.com/stuff.php
in general, after www.example.com/
redirects www.example.com/site/
. user sees original url in browser.
i've looked around on net haven't managed figure out utilize in particular situation.
i tried rewriting everything:
rewriteengine on rewriterule ^$ /site [l]
but index.php
disappears , www.example.com/site/
shown user.
how can utilize .htaccess
solve problem?
you need capture url request incoming server, this:
rewriteengine on rewritecond %{request_uri} !^/site/ rewriterule ^(.*)$ /site/$1 [l,qsa]
the qsa
(eventually) append query string rewritten url
apache .htaccess mod-rewrite redirect
No comments:
Post a Comment