Link to home
Start Free TrialLog in
Avatar of SimpleJ
SimpleJ

asked on

Apache mod_rewrite ?

Hello,

I have apache web server which is hosting some php sites. The sites are accessed locally (within the same network).

How can I setup apache server that url would always be the same?

Example.

My site is in directory /var/www/html/mysite/ and is accessed via: http://server.domain.local/mysite

when I click a link on this site the url changes to:
http://server.domain.local/mysite/links/about.php

how can I setup apache so that in this case the url would be
http://server.domain.local

or

http://server.domain.local/mysite

thx.
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Try one of these:
# to make your default document go to about
RewriteRule ^/?$ /mysite/links/about.php [NC,L]

# to make /mysite go to about
RewriteRule ^/?mysite/?$ /mysite/links/about.php [NC,L]

Open in new window


I'd also like to add that if you'd like that page to be your default document, perhaps you should move it to the root of the site as the index.php page.
I hope you realize that if you have only the one URL, no one can bookmark any of the other pages?
Avatar of SimpleJ
SimpleJ

ASKER

I realize all disadvantages of this approach. However I want always to show just domain or domain/folder1

Just like using frames (the url would always be http://server or http://server/folder1 no matter what the "underlying" url i.e. http://server/folder1/links/wo/content.php?id=2)

Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial