I would like to get friendly URL's working on my site, and I think from CMS's side I've done what is needed, but Apache isn't cooperating (I'm getting 404 errors from the menu-generated links).
I've copied doc/htaccess.txt to .htaccess. I've edited config.php, for $config['assume_mod_rewrite'] = true;
From my httpd.conf:
Options FollowSymLinks
Allow on
DocumentRoot /var/www/html/
ErrorLog logs/error_log
ServerName www.mysite.com
ServerAlias mysite.com
TransferLog logs/access_log
DirectoryIndex index.html index.php index.htm index.shtml
and
LoadModule rewrite_module modules/mod_rewrite.so
Any thoughts?
friendly URLs [Working now]
-
sammex
friendly URLs [Working now]
Last edited by sammex on Tue Aug 09, 2005 9:26 am, edited 1 time in total.
-
100rk
Re: friendly URLs
Try to include directivesammex wrote: Any thoughts?
Code: Select all
AllowOverride All
-
sammex
Re: friendly URLs
I've got a little success but not much yet. First, I moved the rules into my server's httpd.conf file. Second I added some rewrite debugging (logging at verbosity 9).
From my log:
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) init rewrite engine with requested uri /Home.shtml
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (3) applying pattern '^(.*)\.shtml$' to uri '/Home.shtml'
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) rewrite /Home.shtml -> index.php?page=/Home
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (3) split uri=index.php?page=/Home -> uri=index.php, args=page=/Home
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) local path result: index.php
Notice the local path result 'index.php' -- which should be ok, since my CMS is at the root of the server. I changed my rewrite rule to add a leading slash, just for good measure though:
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) init rewrite engine with requested uri /Home.shtml
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (3) applying pattern '^(.*)\.shtml$' to uri '/Home.shtml'
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) rewrite /Home.shtml -> /index.php?page=/Home
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (3) split uri=/index.php?page=/Home -> uri=/index.php, args=page=/Home
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) local path result: /index.php
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) prefixed with document_root to /var/www/html/index.php
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (1) go-ahead with /var/www/html/index.php [OK]
Now, this almost works... except that I end up with a 100% white page where a viewing of the source results in:
Of course, http://www.mysite.com/index.php?page=Home results in a proper page being served up.
Clearly cmsms is being reached, but with what, I wonder?
From my log:
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) init rewrite engine with requested uri /Home.shtml
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (3) applying pattern '^(.*)\.shtml$' to uri '/Home.shtml'
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) rewrite /Home.shtml -> index.php?page=/Home
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (3) split uri=index.php?page=/Home -> uri=index.php, args=page=/Home
[09/Aug/2005:04:23:10 --0400] [www.mysite.com/sid#9c42918][rid#9e24290/initial] (2) local path result: index.php
Notice the local path result 'index.php' -- which should be ok, since my CMS is at the root of the server. I changed my rewrite rule to add a leading slash, just for good measure though:
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) init rewrite engine with requested uri /Home.shtml
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (3) applying pattern '^(.*)\.shtml$' to uri '/Home.shtml'
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) rewrite /Home.shtml -> /index.php?page=/Home
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (3) split uri=/index.php?page=/Home -> uri=/index.php, args=page=/Home
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) local path result: /index.php
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (2) prefixed with document_root to /var/www/html/index.php
[09/Aug/2005:04:24:26 --0400] [www.mysite.com/sid#9219918][rid#93fb270/initial] (1) go-ahead with /var/www/html/index.php [OK]
Now, this almost works... except that I end up with a 100% white page where a viewing of the source results in:
Of course, http://www.mysite.com/index.php?page=Home results in a proper page being served up.
Clearly cmsms is being reached, but with what, I wonder?
-
sammex
Re: friendly URLs
Ok, I turned on CMS debugging, and was given:
SELECT * FROM cms_content WHERE content_alias = '/Home' AND active = 1
SELECT c.content_id, c.cachable, t.modified_date as template_date, c.modified_date as content_date, c.type, c.hierarchy, t.encoding FROM cms_content c INNER JOIN cms_templates t ON t.template_id = c.template_id WHERE c.content_alias='/Home' AND c.active = 1
..... well, here's the problem. content_alias is being searched for as /Home, but it appears as Home (no slash). Argh!
I'm at a loss for what else to try/dig up.
SELECT * FROM cms_content WHERE content_alias = '/Home' AND active = 1
SELECT c.content_id, c.cachable, t.modified_date as template_date, c.modified_date as content_date, c.type, c.hierarchy, t.encoding FROM cms_content c INNER JOIN cms_templates t ON t.template_id = c.template_id WHERE c.content_alias='/Home' AND c.active = 1
..... well, here's the problem. content_alias is being searched for as /Home, but it appears as Home (no slash). Argh!
I'm at a loss for what else to try/dig up.
Re: friendly URLs
It seems that your provider has some general settings activated that override your htaccess-settings. I had the same problem but I could convince my provider (who is a friend of mine) to change my setting so that I can use mod_rewrite and stuff like that via htaccess. If you have a .htaccess that doesn't allow things on a global level, it might block things one level below.
Regards,
Nils
Regards,
Nils
-
sammex
Re: friendly URLs
I am the provider in this case (my box, on a static IP), so I can change configuration if I only know what to change 
I just got this thing working! I currently have the config in the main server configuration (in the VirtualHost section for this root) with this rewrite rule:
RewriteRule ^/(.*)\.shtml$ /index.php?page=$1 [QSA]
The change from the one in cmsms's htaccess.txt are the two forward slashes.
I suspect now that I've got a working rule I can relocate it to the local .htaccess, but is there any particular benefit to it being there (considering, as mentioned, editing the global .conf is not a problem)?
I just got this thing working! I currently have the config in the main server configuration (in the VirtualHost section for this root) with this rewrite rule:
RewriteRule ^/(.*)\.shtml$ /index.php?page=$1 [QSA]
The change from the one in cmsms's htaccess.txt are the two forward slashes.
I suspect now that I've got a working rule I can relocate it to the local .htaccess, but is there any particular benefit to it being there (considering, as mentioned, editing the global .conf is not a problem)?

