[solved]Why I roll back with using mod_rewrite ?
[solved]Why I roll back with using mod_rewrite ?
Hi all
I`ve enabled mod_rewrite for my website , but there is one problem :
when I call www.mysite.com/support.html or any child url,it redirects to
www.mysite.com/index.html and loads content of index page but url in address bar doesn`t change
( it remains www.mysite.com/support.html) .
I used .htaccess file that is placed in doc folder of CMSMS .
I`ve enabled mod_rewrite for my website , but there is one problem :
when I call www.mysite.com/support.html or any child url,it redirects to
www.mysite.com/index.html and loads content of index page but url in address bar doesn`t change
( it remains www.mysite.com/support.html) .
I used .htaccess file that is placed in doc folder of CMSMS .
Last edited by amin30b on Tue Sep 11, 2007 12:23 pm, edited 1 time in total.
-
Pierre M.
Re: Why I roll back with using mod_rewrite ?
Hello,
before activating pretty URLs, how was working your site ?
Have you followed this procedure ?
Are there any other software along with CMSms ?
Are there any other .htaccess or rewrite mechanism ?
Please show the extract of your config.php about URLs.
Please show your .htaccess (to be sure what is in the folder... it shouldn't be long)
What is your webserver ?
Pierre M.
before activating pretty URLs, how was working your site ?
Have you followed this procedure ?
Are there any other software along with CMSms ?
Are there any other .htaccess or rewrite mechanism ?
Please show the extract of your config.php about URLs.
Please show your .htaccess (to be sure what is in the folder... it shouldn't be long)
What is your webserver ?
Pierre M.
Re: Why I roll back with using mod_rewrite ?
Before activating pretty urls all thing was OK .
Yes I read it .
No,there is not any software along it .
No,there is not any other htaccess file .
My webserver is apache .
Yes I read it .
Code: Select all
#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'] = 'page';
No,there is not any other htaccess file .
Code: Select all
#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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Last edited by amin30b on Sun Sep 09, 2007 10:05 am, edited 1 time in total.
Re: Why I roll back with using mod_rewrite ?
For my understanding your last line in .htaccess should be
Code: Select all
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]Re: Why I roll back with using mod_rewrite ?
I did it but still result is same as beforetobik wrote: For my understanding your last line in .htaccess should beCode: Select all
RewriteRule ^(.+).html$ index.php?page=$1 [QSA]
Re: Why I roll back with using mod_rewrite ?
Turn on the rewrite log.
Then you can see what URL is sent to CMSMS. Try this URL in the browser and see if you still got the same result.
Code: Select all
RewriteLog rewrite.log
RewriteLogLevel 2
Re: Why I roll back with using mod_rewrite ?
Where should I place above code ? How could I turn on rewrite log?RewriteLog rewrite.log
RewriteLogLevel 2
Re: Why I roll back with using mod_rewrite ?
Should be placed in httpd.conf
-
Pierre M.
Re: Why I roll back with using mod_rewrite ?
Your config.php seems ok and your .htaccess too.
I hope the rewritelog will give information (thank you tobik).
You can also try these mod_rewrite tests.
Pierre M.
I hope the rewritelog will give information (thank you tobik).
You can also try these mod_rewrite tests.
Pierre M.
Re: Why I roll back with using mod_rewrite ?
Unfortunately I can`t access to httpd.conf file of my web server .
(I think cPanel doesn`t have an option for it),
Also I have read that post and related to it when I place these tags in .htaccess file:
when I call www.mysite.com/cmsms/books.html , it automatically redirects that page
to www.mysite.com . (Two level upper)
Now I`m suspecting to RewriteBase / , But I don`t know correct instruction for it .
(I think cPanel doesn`t have an option for it),
Also I have read that post and related to it when I place these tags in .htaccess file:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# 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]to www.mysite.com . (Two level upper)
Now I`m suspecting to RewriteBase / , But I don`t know correct instruction for it .
Re: Why I roll back with using mod_rewrite ?
I think we need more info about your installation.
- What do you have to type in the browser for page X with pretty url inactive?
- What do you want to type in the browser for page X with pretty url active?
- What is the root_url in your config.php?
- What is the root_path in your config.php?
Re: Why I roll back with using mod_rewrite ?
Hi tobik
Yes , I should place those here
1- http://www.mysite.com/cmsms/index.php?page=books
2- http://www.mysite.com/cmsms/books.html
3- $config['root_url'] = 'http://www.mysite.com/cmsms
4- $config['root_path'] = '/home/user/public_html/cmsms'
Now , it should be easy to find main reason of my problem .
Regards
Omid
Yes , I should place those here
1- http://www.mysite.com/cmsms/index.php?page=books
2- http://www.mysite.com/cmsms/books.html
3- $config['root_url'] = 'http://www.mysite.com/cmsms
4- $config['root_path'] = '/home/user/public_html/cmsms'
Now , it should be easy to find main reason of my problem .
Regards
Omid
Re: Why I roll back with using mod_rewrite ?
OK, then this rewrite_rule should do it
Why do you put cmsms in the subdirectory? Do you have different content in the root http://www.mysite.com/ ?
Code: Select all
RewriteRule ^cmsms/(.+).html$ cmsms/index.php?page=$1 [QSA]Re: Why I roll back with using mod_rewrite ?
If it is in a subfolder...
RewriteBase /nameofsubfolder
RewriteBase /nameofsubfolder
Re: Why I roll back with using mod_rewrite ?
The result is the same. Just don't mix up.



