Forum Moderators: phranque
We have the following url in a dev envrionment:
[192.168.2.30...]
Where example is a sub-directory below the default site and main is main.php
We'd like to be able to drop main from the URL so create a rewrite to translate:
[192.168.2.30...]
back to
[192.168.2.30...]
Then when we roll this in to production do the following:
www.example.co.nz/Very%20Nice%20Hotel/Overview/Hotel%20Services/
rewritten to
www.example.co.nz/main/Very%20Nice%20Hotel/Overview/Hotel%20Services/
Bascially we just want to get rid of main out of the URL
Look forward to your responses
[edited by: jdMorgan at 5:44 pm (utc) on Oct. 17, 2007]
[edit reason] Examplified per Terms of Service [/edit]
So, for example, your robots.txt file would have to be physically relocated to /main/robots.txt -- Obviously not what you want.
Therefore, the question is --given the example URLs above-- how will you identify all URLs for resources that are actually located in /main? It may be simple, for example, if they all start with "Very%20" or it may require a list of URL-paths -- which you would then have to maintain in the code over the long term. Or, if you have many files and subdirectories in main, it may be so complex and/or inefficient as to be of questionable utility.
To ease discussion, just remember that all mod_rewrite execution decisions are based on the URL requested by the client, and not (usually) on any other factors, such as the filepaths to which those URLs ultimately resolve.
Another point --somewhat unrelated to your question-- is that using spaces in your page names is just a very bad idea. It results in very%20ugly%20and%20hard%20to%20read%20URLs, makes coding RewriteRules literally twice as difficult, and can lead to knock-on effects that only make the URLs uglier and the rules even more difficult when you try to correct those. I suggest you seriously consider using hyphens (not underscores) or eliminating the spacing altogether. Hyphens are to be strongly preferred.
Jim