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 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2007
    Posts
    58
    Thanks
    2
    Thanked 6 Times in 6 Posts

    RewriteRule trouble

    .htaccess:
    Code:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    
    
    RewriteRule ^(.*)\.xml$ $1 [L,R=301]
    The goal is to strip off the .xml at the end, similar to removing a .php or .html. This currently is recursive, though I don't see how. Using ^(.*)\.xml$ it should match any amount of anything but end of line, ending with .xml, then rewrite everything EXCEPT the .xml, yeah?

    Edit:
    Code:
    RewriteRule $1 ^(.*)\.xml$ [L,R=301]
    
    RewriteCond %{REQUEST_URI} xml$
    
    RewriteRule ^(.*)\.xml$ $1 [L,R=301]
    That does what I wanted it to do.
    Last edited by Blue_Jeans; 09-11-2010 at 05:15 AM.

  • #2
    New Coder
    Join Date
    Aug 2010
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post
    Try this..

    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.xml -f
    RewriteRule ^(.*)$ $1.xml
    Free Web Hosting - cPanel powered free web hosting


  •  

    Posting Permissions

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