Page 1 of 1

[Solved] Mod_rewrite

Posted: Thu Jan 08, 2009 4:47 pm
by christiaans
Oh gosh, I now officially hate my hosting company (I think)..

I fixed my "locale" thing, but now I am running into a mod_rewrite problem!

UPDATE: * Removed the link because it works now :) *

If you click a link, the content doesn't change, but the address bar location does. It rewrites the links, but it does NOT display the content of that link, what could be causing such a thing? I already strolled through the forum of the hosting company, but mod_rewrite seems to be perfectly supported..

If anyone can help me or tip me, that'd be awesome!

Thanks in advance guys..

Upd: I tried clearing cache, doesn't work either..

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 5:32 pm
by Dr.CSS
How about a little more info on the steps you have taken to get your site to this point...

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 5:36 pm
by christiaans
Sorry, I did the following:

- Upload cmsms 1.5.1
- Copy the htaccess.txt file to root and changed to .htaccess
- Edited config file with mod_rewrite and hierarchy turned on
..

That's it.. I really don't see why it is not working..

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 7:26 pm
by nhaack
what is your .htaccess looking like? CMSMS seems to be doing something. Looks like it doesn't apend the alias to the call in your rewriting.

Best
Nils

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 7:35 pm
by christiaans
My htaccess is the standard htaccess which you get in the package:

Code: Select all

# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# (this is important, so uncomment if your host permit)
#Options -Indexes
#ServerSignature Off
#
Options +FollowSymLinks
#
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms/
RewriteBase /
#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 7:37 pm
by Dr.CSS
And your config URL settings part...

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 7:39 pm
by christiaans
And my config file:

Code: Select all

#------------
#URL Settings
#------------

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = false;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'pagina';

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 7:48 pm
by Dr.CSS
My config looke like that but my htaccess looks like this and I get pretty urls on all links...

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 8:18 pm
by christiaans
I tried your htaccess, but sadly it doesn't help..

I reckon it has to do with the conversion of the links, as Nils stated..

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 8:21 pm
by nhaack
christiaans wrote: And my config file:

#------------
#URL Settings
#------------

....

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'pagina';
You use the query string "pagina" and in your URL Rewriting you use page. Adjust this in your rewriting:

---

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

--- TO THIS ---

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?pagina=$1 [QSA]

---
I think that's it

Best
Nils

Re: Mod_rewrite

Posted: Thu Jan 08, 2009 8:26 pm
by christiaans
PER-FECT!

It works like a charm indeed, I never figured that that would be the problem! Thanks so much..