RewriteRule not working

15,457

Solution 1

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]

Solution 2

Remove the beginning slash:

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

LazyD

Updated on June 04, 2022

Comments

  • LazyD
    LazyD 8 months

    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.

  • LazyD
    LazyD over 11 years
    Hi John, thanks for your inputs. i have already tried that but not working :(
  • LazyD
    LazyD over 11 years
    i was unable to restart the services after the above mentioned changes?
  • LazyD
    LazyD over 11 years
    Are u aware of some online site wherein we can quickly check the same?
  • Salman A
    Salman A over 11 years
    I'm not aware of any website that allows you to tamper with .htaccess files :) But this website might help.
  • LazyD
    LazyD over 11 years
    Thanx Salman... But this site no were states the error.. as u have pointed out above "RewriteRule: bad flag delimiters"..
  • Salman A
    Salman A over 11 years
    Hmmm, the website probably cannot tell if your htaccess or conf file is OK. The error I mentioned was logged in Apache logs; it is the first place you should look when you see the dreaded 500 Internal Server Error.