I have some difficulties with the mod_rewrite rules. I want to rewrite any request on
www.example.com/dev/*
to
www.example.com/*
For example when the request url is www.example.com/dev/index.php
, the response should be www.example.com/dev/index.php
, and not just that the url looks like it's from the root directory, but it is actually using the index.php
from root directory.
I have tried the mod_alias which works
RedirectMatch (^/dev/)(.*) http://www.example.com/$2
But it is not possible to apply ip address conditions with mod_alias, so I still need a solution with mod_rewrite.
Would anyone share some knowledge please? Thanks.
How about something like this?
This would need to be in the root folder, or applied to the primary Apache configuration (not in .htaccess).
The usual rules about .htaccess redirects apply - including that
RewriteEngine on
,Options FollowSymLinks
, andAllowOverride FileInfo
are included somewhere. Full details at http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule.