Page 1 of 1

mod_rewrite rule problems

Posted: Tue May 12, 2009 4:07 pm
by nutkenz
I have several domains on a single server which all share some common code which I want to reference using subdomain.com/lib/file.gif (actually, I'd be using relative paths, but this is what it would refer to), which should then be redirected to another URL so I only need to upload the lib once.

I tried adding the following rule:

Code: Select all

RewriteCond %{REQUEST_URI} ^/lib/(.*)$ [NC]
RewriteRule ^(.*)$ http://libdomain.com/lib/$1 [R=302,L]
This does not seem to work... Any suggestions?

Re: mod_rewrite rule problems

Posted: Wed May 13, 2009 5:51 am
by nutkenz
Was there a more appropriate subforum to post this in? If so, admin, feel free to move this topic.

Re: mod_rewrite rule problems

Posted: Wed May 13, 2009 6:25 am
by prometheuzz
nutkenz wrote:Was there a more appropriate subforum to post this in? If so, admin, feel free to move this topic.
IMO, your post is fine here in the regex forum. The fact that I replied to most new posts in here except yours is that I know jack about the mod_rewrite plug-in. All these RewriteCond and RewriteRule etc. mean nothing to me.

So, if you could ask your question in regex-terms only, I can probably give you a hand. If not, you'll have to wait a bit for someone who knows about this mod_rewrite plug-in.

Good luck.