Re: URL Rewrite

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

 



On April 20, 2011 7:07 , "Rod Behr" <Rod.Behr@xxxxxxxxxxxxxxxxx> wrote:
I want my browser to display only the root canonical URL while browsing: http://www.mydomain.com. Whatever is contained in the URL or querystring following this should not appear in the browser window. So http://www.mydomain.com/index.pl or http://www.mydomain.com/app/subapp/file.extension?var=something&anothervar=somethingelse should both simply show http://www.mydomain.com in the browser window.

Why?  Knowing this might allow us to suggest other solutions.

Note that what you are asking for goes against the way web browsers are designed, is user-unfriendly, and, if you are successful in implementing it, will cause problems for search engines such as Google and Bing (even to the point of them being unable to access your content and/or outright banning your site from search results).  Also, this could cause accessibility issues for people with disabilities, which may be a violation of one or more national or local laws.

Apache HTTP Server can internally rewrite request URLs in a way that is invisible to the web browser and end user, but this will not accomplish what you want:  the web browser will always display the URL that the user originally requested (the link target) even if the content is actually being served from a different URL.  A user would go to http://www.mydomain.com/ but if they then clicked on a link for http://www.mydomain.com/something/else, the web browser would display this second URL in their location bar before sending the request to the web server, and there is no way the web server can change the URL displayed in the location bar short of doing a redirect to a different URL.


The iFrame solution works to a point, but that still reveals the filename containing the iFrame – I want this hidden also.

Another solution is to design your site to use a "front controller" that live at http://www.mydomain.com/ and handles all requests for content for the entire site.  If you did this and did not use path info ("extra path" components) and made all pages except for the main page pass information to the front controller via hidden form fields in POST requests (instead of query strings).  See http://en.wikipedia.org/wiki/Front_Controller_pattern

Finally, you could write a page that uses AJAX to request content from the server whenever the user clicks on a link, dynamically loading that content into various areas of the current web page.  Since a complete page load is never done, the URL in the titlebar will never change from http://www.mydomain.com/    You could configure Apache HTTP Server with rewrite rules so that if a request comes in for any other URL the user is redirected to the site's main page.

Out of curiosity -- your original message implies that you already know how to do what you want with Microsoft IIS but are trying to find the equivalent solution for Apache HTTP Server.  How does IIS do this?

--
  Mark Montague
  mark@xxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux