LazyD
LazyD

Reputation: 83

RewriteRule not working

I am trying to add a rewrite rule in my httpd.conf file but it's not working.

Here's the relevant section:

RewriteRule ^/taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301, L]

Currently, my site name is www.domain.com and I am trying to redirect all the URLs starting with taxonomy/term/{integer} to my new domain www.example.com through an httpd.conf RewriteRule.

Upvotes: 2

Views: 18597

Answers (3)

Salman Arshad
Salman Arshad

Reputation: 272146

Apache must have complained about:

RewriteRule: bad flag delimiters

Remove the white space in your flags. Change this:

[R=301, L]

to:

[R=301,L]

Note: if you're using the rule inside a per-directory htaccess file, you need to omit the leading slash:

RewriteRule ^taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301,L]

Upvotes: 13

AndersTornkvist
AndersTornkvist

Reputation: 2629

Try this in httpd.conf (remove the space, don't remove the slash):

RewriteEngine on
RewriteRule ^/taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301,L]

Upvotes: 1

John Green
John Green

Reputation: 13435

Remove the beginning slash:

 RewriteRule ^taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301, L]

Upvotes: 2

Related Questions