I have a Rails 2.3.18 application running on, it is running with Passenger module, and is deploying on Apache server with proxy module using the following configuration:

<VirtualHost *:80>
    <Proxy *>
        AllowOverride All
        Allow from all
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /path/to/my/app/public
    <Directory /path/to/my/app/public>
        Options +FolowSymLinks
        AllowOverride All
        Order allow, deny
        Allow from all
        RewriteEngine On
        RewriteBase /
        RewriteRule ^folder/(.*)$ /$1 [P]
    ProxyPass /
    ProxyPassReverse /

In the configuration I put the following rule of Rewrite module:

RewriteRule ^folder/(.*)$ /$1 [P]

This would redirect all request that goes to http://mydomain.com/folder/... to http://mydomain.com/... but the rule is not working because.

For example, I request the images from:


the objective is to redirect to


but it is not working, it always uses the first path.

Thank you very much.



Your requests don't begin with folder, they begin with a forward slash.

RewriteRule ^/folder/(.*)$ /$1 [P]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.