CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   .htaccess - Redirect query strings to new URL (http://www.codingforums.com/showthread.php?t=270613)

Cloud Ghost 08-16-2012 09:02 AM

.htaccess - Redirect query strings to new URL
 
Hi,

I have a few URLs with query strings like this:
index.php?id=1
index.php?id=2

And I'd like to redirect each ID to their own SEO friendly URL defined in my .htaccess file (only a few IDs so it shouldn't slow the site). I've tried a code (displayed below) and it does the redirect to the new file name but the new file returns a "404 not found" error. Here's the code I've been trying:

Code:

RewriteEngine On
Options +FollowSymLinks
RewriteCond %{QUERY_STRING} ^id=1$
RewriteRule ^index\.php$ /seo-friendly-url/

Is there something wrong with the code or do I need to add something else to it?

handlegeek 08-28-2012 03:49 PM

Can you give an example of your user friendly URL?

I believe you want to redirect and not just rewrite. You can add 301 redirect like this which might help.

RewriteRule ^index\.php$ /seo-friendly-url/ [R=301]

For more details:
http://www.ganeshbabujayaraman.com/a...and-drupal-cms

Juneelson 09-18-2012 09:21 AM

I Could screen scrape the site and get the html, but i cant get the links out of the html if you have any better ways than what i did please tell me.find more information


All times are GMT +1. The time now is 09:16 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.