httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Bower <>
Subject [users@httpd] mod_rewrite redirect to local path issue
Date Wed, 11 Mar 2009 20:06:38 GMT
I am using mod_rewrite to redirect from a sub-directory of my existing
domain to a new domain just for this section.

Here is my .htaccess file in /othersite/ (specific domains and paths

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /othersite/

    RewriteRule ^(.*)$ http://<myotherwebsite>.com/$1 [R=301,L]

When I go to <mycurrentwebsite>.com/othersite/ (or any file within this
directory) it redirects perfectly fine. The strange part is when I go to
<mycurrentwebsite>.com/othersite (with no trailing slash), I get redirected
to <myotherwebsite>.com//var/www/<mycurrentsite>.com/web/othersite/. Apache
for some reason replaces the $1 with the local path, which is a major
security issue. I would rather not have my server paths revealed in this

I couldn't figure out how to fix this issue, so as a temporary "hacked"
solution by forcing a redirect from "/var/www..." to "/" using mod_rewrite.
This is a very poor work around since my path is still being revealed behind
the scenes.

All my Google searches have turned up empty. Any help would be appreciated.

I am running Apache Version 2.0.52 on CentOS 4.6


- Steven Bower

View raw message