Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-24-2010, 10:51 AM   PM User | #1
bonkerz
New to the CF scene

 
Join Date: Mar 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bonkerz is an unknown quantity at this point
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 :

Code:
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 :

http://www.mywebsite.com/products.php?product-1

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...

bonkerz is offline   Reply With Quote
Old 03-25-2010, 03:03 AM   PM User | #2
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
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.
__________________
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

Last edited by DJCMBear; 03-25-2010 at 03:05 AM..
DJCMBear is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, php, rewrite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:51 PM.


Advertisement
Log in to turn off these ads.