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
    Sep 2004
    Posts
    60
    Thanks
    1
    Thanked 0 Times in 0 Posts

    rewritecond and rewriterule

    Hi,

    I'm trying to get my .htaccess file to redirect correctly.

    Calling from the browser, http://somedomain.com/deals/

    successfully triggers a behind the scenes rewrite:

    Code:
    RewriteCond %{REQUEST_URI} ^/deals/$ [NC]
    RewriteRule ^deals/ /offers/listing.php?query=1 [L]
    And that works. The server internally refers to offers/listing.php.

    However, I want to set up the reverse. If a browser calls http://somedomain.com/offers/listing.php I want to do a 301 redirect to /deals/

    Code:
    RewriteCond %{REQUEST_URI} ^/offers/listing.php.*$ [NC]
    RewriteRule ^.+ /deals/ [R=301,L]
    I can't get that last bit to work. listing.php just loads.

    Any help is appreciated!

    One more thing, the "L" in the first rewrite rule should keep the rest of the htaccess from proscessing, correct?

  • #2
    New Coder
    Join Date
    Sep 2004
    Posts
    60
    Thanks
    1
    Thanked 0 Times in 0 Posts
    weird.

    there was a .htaccess file in the /offers/ directory. Simply had RewriteEngine on.

    Once I commented it out, the htaccess file I'm using in public_html worked.

    Why would that be?

    Also, the browser won't load the page and says it is redirecting in a way that will never complete. What might the solution to that be?
    Last edited by mbannonb; 02-08-2011 at 03:18 AM.


  •  

    Posting Permissions

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