[Solved] Mod_rewrite

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

[Solved] Mod_rewrite

Post 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..
Last edited by christiaans on Thu Jan 08, 2009 8:27 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Mod_rewrite

Post by Dr.CSS »

How about a little more info on the steps you have taken to get your site to this point...
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Mod_rewrite

Post 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..
nhaack

Re: Mod_rewrite

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Mod_rewrite

Post 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>
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Mod_rewrite

Post by Dr.CSS »

And your config URL settings part...
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Mod_rewrite

Post 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';
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Mod_rewrite

Post 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]
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Mod_rewrite

Post 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..
nhaack

Re: Mod_rewrite

Post 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
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Mod_rewrite

Post by christiaans »

PER-FECT!

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

Return to “CMSMS Core”