Rewriterules for different folder levels
After some great assistance from a friend I have got to a stage where im a little stuck. Firstly in plain English I will try to explain the result im trying to achieve:
NB. Please feel free to advise if my structure is incorrect.
A user is sat on my homepage and they see in the menu bar "About us", in the status bar the URL is displayed as follows:
The content file for the page about is called about.php and is located in the webroot above public_html (I have this part working with the following rule)
While navigating the "About us" page the user sees a link to view someones profile called "Profiles", as they hover over that link in the status bar the URL is displayed as follows because I wanted profiles to be a child of about:
RewriteRule ^(([^/]+/)*[^/.]+)$ index.php?page=$1 [L]
Presently I have been unable to achieve this because of mainly a lack of knowledge when it comes to regex etc.
In terms of my folder structure on the server what would you recomend? is it necessary to place all of the files that are "Child files" to the about.php page in a folder called about, or, does the name of the folder not matter?
I am aware that if you have a folder with the same name as the parent file = "about.php" then problems occur, or at least they do for me.
The closest I got was using the following rule but as g1smd quite rightly advised I shouldnt use the optional / otherwise it can lead to duplicate content:
Profiles.php is now located in a folder called "us"
About.php is in the webroot
I believe this approach is completely wrong about as the URL would be displayed as:
RewriteRule ^us/?(([^/]+/)*[^/.]+)?$ /us/index.php?page=$1 [L]
Instead of what I want to achieve:
http://www.example.com/about/profiles (And all the other files located in the same folder like below)
For those kind people that can help me here, would you be kind enough to give advice on the structure of my link too.
Many thanks in advance
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)