Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Thanked 0 Times in 0 Posts

    Question Weird htaccess rewrite problem

    I've taken over management of a corporate website, and it has built in RewriteRules to display products.

    So http://www.mywebsite.com/product-1 displays product 1, however the page "product-1" doesn't actually exist.

    On top of this, if I went to http://www.mywebsite.com/whateveriput/product-1, the product 1 page would STILL be displayed.

    And on top of this, if I put in a fictional page after the domain, such as http://www.mywebsite.com/testing123455, it does not return a 404, instead it displays a page called "products.php" ....

    I've had a look at the htaccess and this is whats in it :

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ products.php?$1 [L]
    Now, I'm no htaccess expert, but this rule seems a BIT open ended! i.e ANYTHING, that isnt a file or a directory gets rewritten via products.php? Is this right? What could I do to make it less open ended?

    Anyway, so I delete this htaccess, and now my products don't work with their rewritten URLS (obviously). So to access them, I would think that all you would have to do is type :


    and the product would be displayed? However it doesn't...

    So how do I find out how to get to my products without the htaccess? I am well confuzzled...

  2. #2
    Senior Coder DJCMBear's Avatar
    Join Date
    Mar 2010
    United Kindom
    Thanked 136 Times in 136 Posts
    have you tryed just putting products.php?1 it may not be right but its worth a shot because products- could be equal to products.php and the 1 could equal ?1

    and seeing as its a corporate website you would have thought they would have put some sort of 404 error system in and also denyed access to product 1 if its looking like its inside a dir.
    Last edited by DJCMBear; 03-25-2010 at 04:05 AM.
    Official BinPress hand picked coder.
    For anyone worried about SQL injection go have a look at my small yet powerful script here.
    Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
    I am 1 of 65,608 people to get a Pebble Watch :P


Tags for this Thread

Posting Permissions

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