Forum Moderators: phranque
I'm building a site which needs to be available to different nationalities. In order to reduce code size I have one set of templates which sit in my root directory and I want users to be directed to various sub-dirs which pertain to their nationality but which in reality reference content in the root.
So when type type [mysite.com...] I need Apache to actually pick up the file situated at mysite.com/file.php (for instance).
Having read the docs I'm unsure whether an alias or a redirect is the right way to go - also for purposes of search engine optimisation I need the url to always be mysite.com/us/content/[whateverfilenamegoeshere.php].
Can anyone make any suggestions?
TIA!
From the mod_alias documentation:
A more powerful and flexible set of directives for manipulating URLs is contained in the mod_rewrite module
Personally, I always use mod_rewrite, because of the additional flexibility.
As far as the redirects, I am not sure I understand exactly what you need, It looks like you just want to 'silently' serve a file from the root, when a specific file is requested.
This is actually fairly simple, but without understanding more about how requests will be delivered, I cannot say for sure...
Will all the requests be served from one file?
Will there be any variables passed?
Will there be separate files for different languages?
Justin
To answer your questions:
* I need *any* requests to us/content/ to be redirected to the root.
* yes variables will be passed - both POST and GET
* There is one set of files which handle all languages (all on-site text is held as strings ina DB and inserted at run-time based on a pre-set cookie.
In short, your assumption hits the nail on the head - I need files to be "silently" served whilst preserving the url, so users requesting /uk/content/file1.php OR us/content/file1.php will get the same file, the browser URL retains the locale setting (ie uk/ us/ de/ etc etc).
Cheers!