Arriba
Arriba

Reputation: 305

a small accident in.htaccess syntax >_<

Internal Server Error. .htaccess:

RewriteEngine on
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^index\.php$ /path-to-new-location/? [L,R=301]
Redirect URLs with query parameters (files placed in subdirectory)

I tried redirect: http://www.example.com/index.php?id=1 to:

http://www.example.com/path-to-new-location/

Was found solution by myself:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?g=(.*)\ HTTP
RewriteRule ^ /%2/%4\? [R,L]

Upvotes: 0

Views: 31

Answers (1)

Lorenz Meyer
Lorenz Meyer

Reputation: 19935

It should be like this

RewriteEngine on
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^index\.php$ /path-to-new-location/ [L,R=301]
# Redirect URLs with query parameters (files placed in subdirectory)

Upvotes: 1

Related Questions