Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-16-2012, 09:02 AM   PM User | #1
Cloud Ghost
New Coder

 
Join Date: Jan 2010
Location: Canada
Posts: 34
Thanks: 11
Thanked 4 Times in 4 Posts
Cloud Ghost is an unknown quantity at this point
.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?
Cloud Ghost is offline   Reply With Quote
Old 08-28-2012, 03:49 PM   PM User | #2
handlegeek
New to the CF scene

 
Join Date: Aug 2012
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
handlegeek is an unknown quantity at this point
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
handlegeek is offline   Reply With Quote
Old 09-18-2012, 09:21 AM   PM User | #3
Juneelson
New to the CF scene

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Juneelson is an unknown quantity at this point
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
Juneelson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:52 AM.


Advertisement
Log in to turn off these ads.