buckeye Posted December 8, 2014 Share Posted December 8, 2014 I am modularizing a existing site as discussed in Chapter 2. All is working fine but I cannot seem to find the correct rewrite script for my .htaccess relative to rewriting (or forwarding existing) links that have been indexed in search engines. An example: http://www.example/productdetail.php?id=100 (as indexed by Google) should display as http://www.example/product-detail/100/ but instead is displaying in address bar as http://www.example/product-detail/?id=100 (and obviously no page is found) My current .htaccess is: RewriteEngine On RewriteRule ^([^/]*)/$ /index.php?p=$1[L] RewriteRule (product-detail)/([^/]*)/$ /index.php?p=$1$id=$2 I also have a URL redirect for this page: Redirect 301 /productdetail.php http:www.example.com/product-detail/ Any assistance would be appreciated. Link to comment Share on other sites More sharing options...
buckeye Posted December 11, 2014 Author Share Posted December 11, 2014 RewriteRule (product-detail)/([^/]*)/$ /index.php?p=$1&id=$2 [L] RewriteCond %{QUERY_STRING} id=([0-9]+) I believe I've solved this issue by including the above lines in the .htaccess file. It now redirects the indexed product id pages to the new, modularized pages. Link to comment Share on other sites More sharing options...
Larry Posted December 12, 2014 Share Posted December 12, 2014 Awesome. Kudos for figuring it out and thanks for sharing! Link to comment Share on other sites More sharing options...
Recommended Posts