Re: RewriteRule to hide PHP vars in URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-10-26 at 07:46 +0530, kranthi wrote:

> <base will just complicate things... (its sure to solve your problems but
> you have to type the relative path to your document root for every URI)
> 
> seems you are looking for
> http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#RewriteCond


I don't think that will do what he wants. Consider the following two
examples:

http://www.example.com/docs/somedoc
http://www.example.com/

Now imagine there was a rewrite rule set up to take these URLs and
convert them into the following server-side:

http://www.example.com/index.php?doc=somedoc
http://www.example.com/index.php

The same index.php page is being used to serve up all the content, but
to the browser, one 'page' is located in the document root, the other
in /docs. Any relative URL's in the pages to images, CSS, Javascript,
etc will be treated as relative to where the browser thinks the page is,
not where the server does. Therefore, you either have to use the <base>
tag or make all the URL's absolute. The <base> tag method allows for
more flexibilty in the future, for example if you changed domain name
slightly.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux