Manolo
Manolo

Reputation: 26370

Redirect any URL starting with some characters

I want to redirect something like:

domain/start[optional]/xxx

to

domain/something/xxx

I've tried to add to .htaccess:

# Rewrite any start* route to something route
RewriteCond %{REQUEST_URI}
RewriteRule ^start[^/]*/(.*)$ /something/$1 [R=301, L]

but I'm getting an Internal Server Error. Any idea of what I'm doing wrong?

The Apache logs says:

RewriteCond: bad argument line '%{REQUEST_URI}'

Upvotes: 1

Views: 3989

Answers (1)

anubhava
anubhava

Reputation: 785058

Your rule has few syntax issues. Try this rule:

# Rewrite any start* route to something route
RewriteRule ^start[^/]*/(.*)$ /something/$1 [R=301,L,NC]

Upvotes: 1

Related Questions