[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Apache mod_rewrite ?

Posted on 2013-12-18
5
Medium Priority
?
197 Views
Last Modified: 2014-01-12
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.
0
Comment
Question by:SimpleJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 39728408
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.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39728427
I hope you realize that if you have only the one URL, no one can bookmark any of the other pages?
0
 
LVL 1

Author Comment

by:SimpleJ
ID: 39728916
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?
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 750 total points
ID: 39729534
Sure it's possible - by using frames.  That's how they work.  Though you could probably set it up, rewrites are not designed to implement this kind of system, and the implementation would be a clumsy hack at best.  There are already processes in place to do what you want.  I recommend looking at them instead of forcing a square peg into the round hole.
0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 750 total points
ID: 39729801
In software like Wordpress, there is code-wise really only one page, the index.php page, which loads content as needed.  But even there, there are parameters passed in the URL to tell it what content is wanted.  You're trying to create a method that can read your mind.
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question