Ok so I have this site.... with the url
http://posnation.com/
and there are alot of pages that i need to save the url structure for....like this
http://posnation.com/restaurant_pos
http://posnation.com/quickservice_pos
http://dev.posnation.com/retail_pos
ext....
The problem that i have now is that i want to save the same url for all these pages and I am looking for the best approach. The way its working now is its done with a code in miva and we are getting off miva.... I know I can create a folder named restaurant_pos or whatever the url is and create an index.php in there.This approach will work but the problem is I need to do this for 600 different pages and I dont feel like creating 600 folders in the best approach.
any ideas
You should use .htaccess to route all the requests to a single file, say index.php and do the serving from there based on the requested URL.
The following .htaccess file on the server root will route all the requests to your index.php:
Now you should parse the $_REQUEST['route'] to identify which file you should serve. Here is an example that will serve a page based on the last element of the URL (ex: pos):
Definitely you'll need to write your own logic, the above is just an example.
Hope this helps.
Usually the easiest way to do this is to create an .htaccess file that redirects all requests to
/index.php
. In/.index.php
you analyze the URL using probably$_SERVER['REQUEST_URI']
and include the appropriate content.Heres a sample htaccess
In your
/.index.php
do something like ... (this is just a VERY simple example)Now if someone goes to
http://posnation.com/restaurant_pos
pages/restaurant_pos.php
will be included.pages/restaurant_pos.php
could include the header and footer too.