Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2010
    Location
    Canada
    Posts
    34
    Thanks
    11
    Thanked 4 Times in 4 Posts

    .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?

  • #2
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    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

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •