MarcF
MarcF

Reputation: 3299

Correct mod-rewrite rule

I would like to allow http access to data normally found at:

http://test.mydomain.com/content/base/plugin/*

without requiring duplication, to also be available at:

http://test.mydomain.com/plugin/*

Importantly I want to avoid redirects as both paths needs to be valid references to the desired data.

I've been playing around with various .htaccess rules but I don't seem to be getting the syntax right. If someone could point me in the right direction that would be greatly appreciated:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/content/base/plugin/(.*)$ /plugin/$1 [L] 

Upvotes: 0

Views: 24

Answers (1)

anubhava
anubhava

Reputation: 785266

If /content/base/plugin/ is your actual path then these rules should work in root .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^plugin/(.+)$ /content/base/plugin/$1 [L,NC]

Upvotes: 1

Related Questions