tags:

views:

42

answers:

2
RewriteRule ^[^/.]*$ new/$0

everytime i type mydomain.com/somepath/to/somewhere it throws 404

its supposed to translate to : mydomain.com/new/somepath/to/somewhere

+1  A: 

Whether or not you need a leading slash will depend on if you are doing this in the httpd.conf file or in .htaccess or in a container within httpd.conf.

To avoid rewrite loops you will want to use a RewriteCond to make sure you are not matching new/

Not sure if the $0 syntax works without capturing parentheses?

Devin Ceartas
A: 
R. Bemrose
In all regex languages I've see, characters are literal inside []
erikkallen
Whoops, you're probably right. In that case the RegEx is still wrong, though.
R. Bemrose
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
gwegaweg
Oh, right... need to block it from redirecting items from the /new directory...
R. Bemrose
how can i do that ? should i put this into httpd.conf not .htaccess
gwegaweg
I just added a RewriteCond that should help... not sure, I don't have a local Apache install here to test it.
R. Bemrose
Forgot a character in the RewriteCond. Should be fixed now.
R. Bemrose