I'm managing an e-commerce site for a customer that was built using JShop on Apache. For SEO reasons links are like:


which get mapped to:


which give the same pages as:


Somehow this is achieved without mod_rewrite (I have confirmed this by disabling mod_rewrite and commenting out all rewrite rules in all conf and .htaccess files).

Note: The files section.php and product.php exist, but section and product do not, nor are there symlinks.

The problem is that on the production server this behavior stopped happening. On my dev server it still works. I was able to get the production server working correctly again by using mod_rewrite since this is the only way I know how to do this. However I really need to know what changed on the production server in the first place so I can properly understand the problem (to avoid other unforeseen consequences). I have restarted Apache and undone all changes I was making on the production server at the time the URLs became broken. They are still broken (without my new rewrite rules).

What methods other than mod_rewrite can be used to remove .php extensions from URLs?


Content Negotiation can do this. Enable MultiViews for shop folder:

<Directory "/path/to/shop">
    Options FollowSymLinks +MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

When the server receives a request /shop/section/3151/1/flowers (section does not exist), it will look up for section.* in shop folder, sort based on the media types and content-encodings send by the browser and choose the best match.

  • Wow, thanks, this was exactly the reason. I never knew MultiViews worked this way.
    – rwired
    Sep 13 '11 at 11:41

Mod_alias, perhaps. Something like:

AliasMatch ^/shop/section/(.*)/(.*)/(.*)$ /shop/section.php?xSec=$1&xPage=$3
AliasMatch ^/shop/product/(.*)/(.*)$ /shop/product.php?xSec=$1

It could be using PATH_INFO - more details here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.