Reputation: 2962
I have:
public/
-- index.php
-- my_subdir/
---- index.php
I simply want to re-route to my_subdir.
(why? because my_subdir contains my new joomla website.)
EDIT, to explain why all the other solutions were not working ... I have been working on this for a couple of hours, and nothing worked. Even the accepted answer here did not initially work. The problem was Not the many solutions provided by google, but rather that I had conflicting rules/conditions.
So here is an example of what I had that was not working (the stuff to the right of the arrows is WHAT I needed to get everything working):
RewriteEngine on
<<<< RewriteCond %{REMOTE_HOST} !^111\.111\.111\.111
######## my ip address for testing
######## because this was not originally included,
######## apparently I was being redirected to maintenance.html ...
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ /maintenance.html [R=302]
######## thus by the time the script/server got to this line
######## I was actually at maintenance.html,
######## and so this next condition did not apply to me
RewriteCond %{REQUEST_URI} !^/my_subdir
RewriteRule ^.*$ /my_subdir/$0 [L]
Upvotes: 0
Views: 165
Reputation: 74018
If you have the same directory structure below my_subdir
, you can simply rewrite everything with
RewriteCond %{REQUEST_URI} !^/my_subdir
RewriteRule ^.*$ /my_subdir/$0 [L]
If you want to redirect instead, i.e. make the new URL visible in the browser, you must also add the R
flag
RewriteRule ^.*$ /my_subdir/$0 [R,L]
Upvotes: 1