0

After installing this plugin: http://www.4homepages.de/forum/index.php?topic=17598.0 there is a problem - operate simultaneously old and new URLs.

I appeal to you for help in 301 redirect the old URLs to the new ones:

for example:

old: /categories.php?cat_id=1
New: /cat-categoryname-1.htm

old: /details.php?image_id=2
New: /img-imagename-2.htm

Sorry for my english. Thank you and best regards.


I tried the finished commands found on the Internet, unfortunately without results.

My .htaccess is: However, they operate old and new URLs.

RewriteEngine On 

#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}

I was able to do so far "incomplete" 301 redirect in PHP. The file categories.php added at the beginning:

if (strpos($_SERVER['REQUEST_URI'], 'cat_id') !== FALSE) { 
header('HTTP/1.1 301 Moved Permanently');
header('Location: cat-'.$_GET['cat_name'].'-'.$_GET['cat_id'].'.htm');
exit;
}

But I do not know how to download the MYSQL database category name ['cat_name'] - Help

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Szooguun
  • 1
  • 1

0 Answers0