😕😕
Hi all,
My website has been running a few months now after a few tweaks here and there.
The I now have is that it does not quite use user friendly URL's and you will see what I mean in the example below:
CURRENT CONFIGURATION
This is the structure of my .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^robots\.txt$
RewriteRule ^(foo|bar|contact|folder1||folder2|folder3)/([a-zA-Z0-9_-]+) /index.php?p=$1/$2 [L]
# error
ErrorDocument 404 "http://www.mysite.co.uk
/web/404"
ErrorDocument 301 "http://www.mysite.co.uk
web/301"
# end
This is my current directory structure:
index.php
foo/home.php = home page
bar/about.php and other various files
folder3/contact.php and other various files
This is a snippet of my index.php file:
$page = isset($_GET['p']) ? $_GET['p'] : '/foo/home';
switch($page) {
/* SUPPORT MODULE */
/*----------------------- ABOUT PAGES -----------------------------------*/
case 'bar/about':
$title = 'this is my title';
$keyword = 'these, are, my, keywords';
$description = 'this is my description';
break;
I then have various header, footer and navbar includes below.
So when you navigate to my website you get this in the address bar.
www.mysite.co.uk - click on the link for about and the URL looks like this:
www.mysite.co.uk/bar/about/
remembering that the file and other related files are located in the directory bar which I know is strictly not the best way.
I want to happen is this:
each directory has an entry page for example:
in the bar directory the entry page is about.php
in the foo directory the entry page is home.php
I want to bring the entry pages into the root so that the URL is displayed like so:
http://www.mysite.co.uk/about
or
http://www.mysite.co.uk/home
remembering that these pages could lead to other files in different directories. For eample:
When you have entered the page about, you may see a link to "moreabout", which would translate the URL to be:
http://www.mysite.co.uk/bar/moreabout
If you understand where I am coming from is anyone able to help me in detail. My knowledge is okay but this has completely thrown me.
Any help is apporeciated 😕😕😕