1827922 Members
2470 Online
109971 Solutions
New Discussion

Apache2 rewrite rules

 
SOLVED
Go to solution
Piotr Kirklewski
Super Advisor

Apache2 rewrite rules

Hi there
I need to hide some parts of the links in my domain:

http://www.my-domain.pl/1275-long-xdgt-bbbb-ccc-p-124.html?sale=LG-12.75-long-xdgt-bbbb-ccc

I want to show only http://www.my-domain.pl/ .

I also have some rules but they don't work:

RewriteEngine On

rewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(php|html?)\ HTTP/
rewriteRule ^index\.(php|html?)$ http://www.my-domain.pl/ [R=301,L]

#
rewriteCond %{HTTP_HOST} ^www.www.my-domain.pl\.pl
rewriteRule (.*) http://www.my-domain.pl/$1 [R=301.L]


I'm still getting very long strings in the address bar.

Is there anyone who could explain why the rules wan't work ?

Reagrds

Peter
Jesus is the King
2 REPLIES 2
Matti_Kurkela
Honored Contributor
Solution

Re: Apache2 rewrite rules

The rewrite rules only manipulate requests coming in from the browser, not the replies going out from the server.

Rewriting your long URL to point to the short URL would only make the long URL impossible to reach: any attempts to access it would only return the title page of your domain instead.

Usually the hiding of the long links is performed by first sending a frameset to the browser, then updating only the inner frames of the frameset. (i.e. the short URL sends the frameset and a some sort of session key, which might be a session cookie or a field in the inner-page URLs. If someone tries to access the inner pages without a valid session key, they can be redirected to the title page to pick up the frameset first.)

Of course, all data you send to the browser will be accessible to the user in some way: don't build your site security on the assumption that "nobody uses View Source".

MK
MK
Steven E. Protter
Exalted Contributor

Re: Apache2 rewrite rules

Shalom,

To achieve this goal, re-arrange the content on the server to a different layout.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com