Howdy_McGee
Howdy_McGee

Reputation: 10663

Redirect 301 With Flags

Can I use the Redirect 301 with Flags like NC and L?

For example:

Redirect 301 /test.htm /example/test/ [NC, L]

I'm getting server errors but I'm not sure if it's because Redirect 301 doesn't allow flags at the end of the statement or if it's something else.

Upvotes: 4

Views: 3662

Answers (2)

anubhava
anubhava

Reputation: 785491

As JimDini mentioned you need mod_rewrite for those flags. Here is the code that should work for you:

RewriteEngine On   
RewriteRule ^test\.html?$ /example/test/ [R=301,NC,L]

Upvotes: 3

JimiDini
JimiDini

Reputation: 2069

Flags you mentions are related to mod_rewrite, but Redirect is part of mod_alias and has different syntax.

See here: https://httpd.apache.org/docs/current/mod/mod_alias.html#redirect

Upvotes: 4

Related Questions