You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rod Behr <Ro...@impact-europe.com> on 2011/04/20 13:07:44 UTC

[users@httpd] URL Rewrite

Hi

 

New to Apache, but learning fast. Knocks IIS into a cocked hat, but I
have a newbie question:

 

I have looked through the documentation and examples for the mod_rewrite
module and although I think my request is simple, I cannot find the
solution to it in either this documentation or the "Practical Solutions
to Common Problems" section. Google throws me back to these same pages.

 

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&anotherv
ar=somethingelse should both simply show http://www.mydomain.com in the
browser window. The iFrame solution works to a point, but that still
reveals the filename containing the iFrame - I want this hidden also.

 

Simple, I know, but search as I might...

 

Many thanks for the assist!

 

Rod

 

Rod Behr
Software Design Manager

( +44 (0) 1932 733 849 (Impact) | +44 (0) 7976 112 442 (mobile) | +44
(0) 1932 733 700 (switchboard)
Impact | Europe House, 170 Windmill Road West, Sunbury-on-Thames,
Middlesex, TW16 7HB
www.impact-europe.com <http://www.impact-europe.com/>  |
rod.behr@impact-europe.com <ma...@impact-europe.com> 

 


www.global-presence.org

Travel less, videoconference more. It does not cost the Earth.

--------------------------------------------------------------------

Impact Marcom Ltd trading as Impact | Registered in England No. 1166286. Registered Address: Europe House, 170 Windmill Road West, Sunbury-on-Thames, Middlesex, TW16 7HB

The information contained in this message is intended only for the recipient, and may be privileged, confidential and/or protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. Impact Marcom Ltd reserves the right, subject to applicable local law, to monitor and review the content of any electronic message or information sent to or from Impact Marcom employee e-mail addresses without informing the sender or recipient of the message.

Re: [users@httpd] URL Rewrite

Posted by Francois Gingras <fr...@gmail.com>.
On Wed, Apr 20, 2011 at 7:07 AM, Rod Behr <Ro...@impact-europe.com> wrote:
> Hi
>
>
>
> New to Apache, but learning fast. Knocks IIS into a cocked hat, but I have a
> newbie question:
>
>
>
> I have looked through the documentation and examples for the mod_rewrite
> module and although I think my request is simple, I cannot find the solution
> to it in either this documentation or the “Practical Solutions to Common
> Problems” section. Google throws me back to these same pages.
>
>
>
> 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. The
> iFrame solution works to a point, but that still reveals the filename
> containing the iFrame – I want this hidden also.
>
>
>
> Simple, I know, but search as I might…
>
>
>
> Many thanks for the assist!
>
>
>
> Rod
>
>
>
> Rod Behr
> Software Design Manager
>
> ( +44 (0) 1932 733 849 (Impact) | +44 (0) 7976 112 442 (mobile) | +44 (0)
> 1932 733 700 (switchboard)
> Impact | Europe House, 170 Windmill Road West, Sunbury-on-Thames, Middlesex,
> TW16 7HB
> www.impact-europe.com | rod.behr@impact-europe.com
>
>
>
> www.global-presence.org
> P TRAVEL LESS | VIDEOCONFERENCE MORE | IT WON'T COST THE EARTH
> ________________________________
> Impact Marcom Ltd trading as Impact | Registered in England No. 1166286.
> Registered Address: Europe House, 170 Windmill Road West, Sunbury-on-Thames,
> Middlesex, TW16 7HB
>
> The information contained in this message is intended only for the
> recipient, and may be privileged, confidential and/or protected from
> disclosure. If the reader of this message is not the intended recipient, or
> an employee or agent responsible for delivering this message to the intended
> recipient, please be aware that any dissemination or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please immediately notify us by replying to the
> message and deleting it from your computer. Impact Marcom Ltd reserves the
> right, subject to applicable local law, to monitor and review the content of
> any electronic message or information sent to or from Impact Marcom Ltd
> employee e-mail addresses without informing the sender or recipient of the
> message.
> ________________________________
>

See http://httpd.apache.org/docs/trunk/rewrite/remapping.html#canonicalhost

Frank

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] URL Rewrite

Posted by Mark Montague <ma...@catseye.org>.
  On April 20, 2011 7:07 , "Rod Behr" <Ro...@impact-europe.com> 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 
> <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@catseye.org