SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Urgent help need please - .htaccess and asp urls

    I am trying to redirect (301) this URL: -

    /Contents/Text/Index.asp?SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383

    It is not working...

    This is the .htaccess file content: -

    DirectoryIndex index.php

    RewriteEngine on

    #any URL request that doesn't have an extension will be redirected to index.php
    RewriteRule !\.[a-z]{2,7}$ index.php

    redirect 301 /Contents/Text/Index.asp?SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383 http://olddomain/

    Any help will be very gratefully received! Many thanks.

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,077
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    The file does have an extension, namely .asp, so your RewriteRule is out.

    The 'redirect' directive doesn't do query strings so that one's out to. What you want is a combination of a RewriteCond and a RewriteRule

    Code:
    RewriteEngine On
    
    RewriteCond %{QUERY_STRING} ^SiteId=476&SiteExtra=19749316&TopNavId=425&NavSideId=5383$
    RewriteRule ^/?Contents/Text/Index\.asp$ index.php [L,R=301]
    Are you sure & shouldn't be & btw?
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

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

    It definitely should only be &!

    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


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
  •