0

I have a Rails 2.3.18 application running on http://0.0.0.0:3004/, 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
    </Proxy>
    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]
    </Directory>
    ProxyPass / http://0.0.0.0:3004/
    ProxyPassReverse / http://0.0.0.0:3004/
</VirtualHost>

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:

http://mydomain.com/folder/images/image.jpg

the objective is to redirect to

http://mydomain.com/images/image.jpg

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

Thank you very much.

JT

0

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.