Page 1 of 1

.htacces redirect issue

Posted: Wed Oct 29, 2008 7:54 pm
by zircle
I have a little problem.

Iv'e set up my CMSMS to show "pretty urls"

first i created a .htaccess file and entered the following code:

Code: Select all

# 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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Then i added these lines to the config.php file:

Code: Select all

$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '/';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
The urls were then made "pretty" so this works fine.

Then i added the following lines to the .htacces file to rediret all incoming traffic from domain.com to www.domain.com:

Code: Select all

[b]RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L][/b]
Below ive added the code so you can see it in context:

Code: Select all

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Afteriadding these 3 lines i could no longer log in, when i removed them again i could log in again, so these three lines must do something that causes me to be unable to log in.

Does anyone know how i can solve this problem?
Im not sure which version of php im using but im runnnign MySQL 5.
CMS Made Simple Version : cmsmadesimple-1.4.1-base

Any help will be greatly appreciated :)

Best Regards

Zircle

Re: .htacces redirect issue

Posted: Wed Oct 29, 2008 9:09 pm
by Pierre M.
not CMSms specific... shouldn't be asked here
Here is a hint.

Pierre M.