SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MAJOR help needed in redirecting ASP pages through htaccess

    I am fairly new to redirects and I can do the basic 301 or canonical, but I am having an extremely hard time with .asp and I need you smart people to help me!!

    The site I do SEO for has a ton of duplicate content and I am trying to fix that by redirecting URL's to the appropriate pages. What is happening is that I have X number of URLs all going to the same page when they should be redirected elsewhere. The problem is that the query string that comes with these URLs is throwing me off and I don't know how to get around them and have tried every way possible.

    For example:
    alturahomes.com/form.asp?PageID=7
    alturahomes.com/customer-care

    I need the form.asp link to go to the /customercare. I have tried many variations of this code to no avail:
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^id=7 [NC]
    RewriteRule ^form\.asp$ /customercare [R=301,L]

    I know I'm doing something wrong, but i just can't figure it out! Your help in this matter would be GREATLY appreciated!
    Last edited by Mittineague; Sep 18, 2013 at 13:11. Reason: delinking example URLs

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,645
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    MP,

    There's nothing technically wrong with your code (except that it lacks the redirection to a useful link, something which can be output by the server and the missing "-" in the mod_rewrite redirection [a typo?]) albeit the No Case flag is typically used on the {HTTP_HOST} variable.

    Like another current thread, I suspect that the problem may have to do with your use of IIS rather than Apache. There are at least two pseudo-mod_rewrite versions from M$ which are vastly different (only one uses Apache's mod_rewrite code to emulate mod_rewrite's actions).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Tags for this Thread

Bookmarks

Posting Permissions

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