N8Webs
10-23-2005, 10:19 PM
I design most of my web sites with a index.php file and then code to 'call' the content which is dictated by www.website.com/index.php?page=abc123
I've checked my stats and it doesn't give me stats on which page was called, simply that index.php was viewed xx times.
Is there a way I can track which page was loaded (other than putting it a separate directory or renaming the file)?
Thanks,
Michael
the_pm
10-23-2005, 10:55 PM
You could use mod rewrite to change those page calls into more intuitive file names. This would not only allow you to track pages better, it will also make it easier for people access your pages, and it can aid in search engine ranking :)
N8Webs
10-24-2005, 07:09 AM
cool - but I have no idea how to do that.
Any recommendations where I can go to read how to do that?
the_pm
10-24-2005, 08:36 AM
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html - Here's the Apache documentation on mod rewrite
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html#introduction - This looks like a nice tutorial :)
N8Webs
10-24-2005, 09:30 AM
Here's what I have so far:
RewriteEngine on
RewriteRule ^bio.shtml$ index.php?page=$1
however it only works for the page bio.shtml. Is there a wildcard I can use like ^*/.shtml (tried that it doesn't work).
thanks
N8Webs
10-24-2005, 10:41 AM
Got it, here's what I'm using:
RewriteEngine on
RewriteRule ^(.*)\.shtml /index.php?page=$1
RewriteRule ^/health(.*)\.shtml /health_page.php?page=$1
however my next challenge is that the page called health_page pulls info from another web site (so the files are not located in the same directory.
When I type in: www.website.com/health/hi
It loads the content of the file named 'hi' within the local directory. Ideally I would like it to load the file name 'hi' that is located in another directory.
For example I have 5 web sites that I've created using a 'php template.' The content of each site is in an independent folder, so www.site1.com/index.php?page=page1 will load a unique shell but common information as www.site2.com/index.php?page=1
Using the rewrite feature if I use www.site1.com/page1 it will load content based on a file that I need to put in the local directory call page1, and it won't try to load information off the independant server even though www.site1.com/index.php?page=1 works.
Does that make sense, any thoughts?
Thanks!