Is it possible to mod_rewrite BASED on the existence of a file/directory and uniqueID?

Posted by JM4 on Pro Webmasters See other posts from Pro Webmasters or by JM4
Published on 2011-02-22T23:09:07Z Indexed on 2011/02/22 23:34 UTC
Read the original article Hit count: 245

Filed under:
|
|

My site currently forces all non www. pages to use www.

Ultimately, I am able to handle all unique subdomains and parse correctly but I am trying to achieve the following:

(ideally with mod_rewrite):

when a consumer visits www.site.com/john4, the server processes that request as: www.site.com?Agent=john4

Our requirements are:

  • The URL should continue to show www.site.com/john4 even though it was redirected to www.site.com?index.php?Agent=john4
  • If a file (of any extension OR a directory) exists with the name, the entire process stops an it tries to pull that file instead:
    • for example: www.site.com/file would pull up (www.site.com/file.php if file.php existed on the server. www.site.com/pages would go to www.site.com/pages/index.php if the pages directory exists).

Thank you ahead of time. I am completely at a crapshot right now.

© Pro Webmasters or respective owner

Related posts about php

Related posts about mod-rewrite