I am looking if the is an easy way to keep the webpage always with the URL like:
http://example.com
at the time there are request like
http://example.com?target=dirigido http://example.com/a-quien-va-dirigido/ http://www.example.com/a-quien-va-dirigido/ ...
behind.
Anybody could help?
EDIT
The following rule
RewriteRule ^(.*)$ http://example.com/$1 [L,R=permanent]
seems to lose the ?target=dirigido request.
EDIT2
The case is the site is a single-page-application in which I load the needed html file by a a jquery load function. They recently asked me to add a carrousel with a link to the different parts of the site, so I added a request param
?target=<content>
and I load the correspondant content.
I added some rules to make beutify urls
static resources not found when mod_rewrite
But when the user goes to:
http://inside.amimusa.org/el-equipo
firstable it’s fine, but since the page it’s a single-page application, when he/she navigates throght the menu, he/she is really going to, let’s say
http://inside.amimusa.org/programa-integrativo-para-directivos/
but in the address bar it keeps: http://inside.amimusa.org/el-equipo what is awful.
So I was thinking to make all the site works hidden everything under the domain, but the request have still to work.
Answer
Assuming Apache:
RewriteEngine On
RewriteRule ^(.*)$ http://example.com [L,R=permanent]
The initial match (^.*$
) can be all sorts of things. I chose one that does give you access over the request URI via $1
, should it be necessary.
If you simply want to make sure everybody uses the same domain and rewrite all to one, use:
RewriteEngine ON
RewriteCond %{HTTP_HOST} !=domain.com
RewriteRule ^(.*)$ http://domain.com$1 [L,R=permanent]
Attribution
Source : Link , Question Author : manou , Answer Author : Halfgaar