Page 1 of 1
[SOLVED] problems with .htaccess
Posted: Tue Jan 31, 2012 12:16 pm
by georgechr
Hey guys
I am having some problems with the .htaccess file and would like your help.
I am on VPS hosting with CPanel and plan to create a lot of websites with CMSMS.
I would like to know if there is an .htaccess file that covers all that is needed for friendly urls and security that i can use in all my sites.
My existing .htaccess file has the following which i am not sure is correct (anafotia2012 is a folder of a CMSMS site under my public_html folder):
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteBase /anafotia2012/
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# except for form POSTS
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
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]
If anyone could help it would be great.
Thanks in advance
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 12:45 pm
by jospanner
Have you turned on mod_rewrite in the config?
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 2:14 pm
by georgechr
yes i have
the main problem i have is that i have a number of websites with CMSMS under my public_html folder. I then use Addon domains to point to the specific folder.
And even if the page loads fine with the domain eg.
www.anafotia.org, when navigating in the site i get the
http://xxxx.com/anafotia2012/ path.
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 2:27 pm
by Jo Morg
I may be wrong but I think you have to remove:
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 2:49 pm
by georgechr
Jo Morg wrote:I may be wrong but I think you have to remove:
Thanks for the reply. Removed it but nothing changed
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 2:55 pm
by Jo Morg
If your addon domain points to anafotia2012 it should work, unless your config.php has some wrong setting, at least AFAIK.
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 4:07 pm
by georgechr
my addon points to public_html/anafotia2012
i havent changed anything else on my config.php except mod_rewrite
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 6:19 pm
by Dr.CSS
This needs the last / removed...
RewriteBase /anafotia2012/
Should be...
RewriteBase /anafotia2012
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 9:26 pm
by georgechr
Removed the last / but still no luck.
I cant seem to understand where the problem lies.
Using
www.anafotia.org the page loads fine but when navigating still the same problem.
Could it be something other than .htaccess?
Is the rest of my .htaccess file correct?
Re: problems with .htaccess
Posted: Tue Jan 31, 2012 10:15 pm
by Jo Morg
I have to say I can't quite get what is the problem you are having. It is my experience, that when I install cmsms in a sub-folder and point to that folder as a sub-domain or addon domain I wouldn't need the RewriteBase /<basedirectory> (without the trailing slash as DrCss so well pointed out), since all the url calls come from the h**p//www.<yourdomain>.com
If IIRC the RewriteBase directive should only be present if you wanted to point all your URL's to h**p//www.<yourdomain>.com/<basedirectory> which if I understand you correctly is NOT what you want. As for the rest of your .htaccess file I'm not an expert but the one that comes with cmsms itself never failed me, only having to use or not RewriteBase when needed.
Re: problems with .htaccess
Posted: Wed Feb 01, 2012 7:13 am
by georgechr
Like i said, the installation was done on a VPS hosting with CPanel installed.
I just installed my CMSMS using Softaculous into folder anafotia2012 under my public_html.
I havent made any other changes except the mod_rewrite in config.php
<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'XXXXXXXXXXXXXXX';
$config['db_password'] = 'XXXXXXXXXXXXXXX';
$config['db_name'] = 'XXXXXXXXXXXXXXX';
$config['db_prefix'] = 'cms_';
$config['db_port'] = 0;
$config['root_url'] = '
http://netinfoplc.com/anafotia2012/';
$config['timezone'] = 'America/New_York';
$config['default_encoding'] = 'utf-8';
#------------
#URL Settings
#------------
#What type of URL rewriting should we be using for pretty URLs? Valid options are:
#'none', 'internal', and 'mod_rewrite'. 'internal' will not work with IIS some CGI
#configurations. 'mod_rewrite' requires proper apache configuration, a valid
#.htaccess file and most likely {metadata} in your page templates. For more
#information, see:
#
http://wiki.cmsmadesimple.org/index.php ... ty_URL.27s
$config['url_rewriting'] = 'mod_rewrite';
#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '';
#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';
?>
I tried changing $config['root_url' to
http://www.anafotia.org but it doesnt even load the second pages i get errors.
The addon domain seems to be working fine because the loads up fine. I just dont get it
Re: problems with .htaccess
Posted: Wed Feb 01, 2012 10:21 am
by Jo Morg
Ok, if you want to use "
http://www.anafotia.org":
1st - change the config.php
Code: Select all
$config['root_url'] = 'http://netinfoplc.com/anafotia2012/';
to
Code: Select all
$config['root_url'] = 'http://www.anafotia.org'
2nd - remove the
3rd - General advise: don't use Softaculous or similar installation scripts as those tend to make assumptions... Just use the CMSMS provided installer on the folder you want it installed.
I think that will solve your problem.
Re: problems with .htaccess
Posted: Wed Feb 01, 2012 10:38 am
by georgechr
It works! Thanks a million!
I just used softaculous because i have a lot of installations to do and though it would be easier.
You made my day
Thanks again
Re: problems with .htaccess
Posted: Wed Feb 01, 2012 10:54 am
by Jo Morg
NP.
Just add [Solved] at the beginning of the topic title.
