1

I have some old links (old platform) and I want to redirect them to the new ones. I have both old and new links but I can figure it how to modify the .htaccess file. Everything I try causes a 500 error.

Here is my .htaccess file:

<IfModule autoindex>
  IndexIgnore *
</IfModule>
Options +FollowSymlinks
Options -Indexes
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

Here is what I've added.

Redirect /index.php?c=newslist&id=12911 /news/article-name-etc-etc

Can someone help me?

1

Put this ABOVE your current htaccess lines:

RewriteEngine On

Redirect 301 /index.php /news/article-name-etc-etc?
  • RewriteEngine On is always a requirement
  • You need to put the command above because that first conditional in your code is messing with the index.php
  • The ? at the end of the new url strips the query strings.

This is a cool tool for tinkering with htaccess code: http://htaccess.mwl.be/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.