SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with htaccess file

    Hello:

    I need to add a line to my .htaccess file so that it does not redirect on xml files, so that I can submit sitemaps to google. My site is relatively large, so I am adding a separate sitemap for each subcategory. My existing .htaccess file looks like:

    RewriteEngine On
    RewriteRule ^([^/]*)/([^/]*)$ /index.php?cat=$1&subcat=$2 [L]
    RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /index.php?cat=$1&subcat=$2&product=$3 [L]
    Richard DeJong

    Admin
    http://www.soldquick.ca

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Add this before your rules:

    Code:
    RewriteCond %{REQUEST_FILENAME} !-f
    This will exclude any file that actually exists from being rewritten. That way a request for sitemap.xml, when sitemap.xml is really there, will just be served as usual, while requests for your made-up URLs will continue to go to /index.php.

  3. #3
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, that worked. The odd thing was I had to swap the two rules I have in order for it to work. Not sure why, but I got google to recognize the sitemap now anyways after I changed the order of the rules
    Richard DeJong

    Admin
    http://www.soldquick.ca

  4. #4
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm... strange, I can now see my xml file in my browser, when I go to the appropriate url, but google still says that the file is an html page.
    Richard DeJong

    Admin
    http://www.soldquick.ca


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
  •