Question

I'm trying to get my .htaccess to redirect all requests to the /blogs directory, except for requests that start with /staff. This is what I have so far:

RewriteEngine On
RewriteRule ^staff(.*)$ staff/$1 [L]
RewriteRule ^(.*)$ blogs/$1 [L]

It works fine for every case, except when I do http://mydomain.com/staff or http://mydomain.com/staff/alice in which case I get a 500 Internal Error.

What am I doing wrong?

Was it helpful?

Solution

Try this:

RewriteRule ^staff/  - [L]
RewriteRule !^blogs/ blogs%{REQUEST_URI} [L]

OTHER TIPS

What is logged to error.log? The error may be coming from either mod_rewrite or from your application itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top