[SOLVED] problems with .htaccess

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

[SOLVED] problems with .htaccess

Post 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
Last edited by georgechr on Wed Feb 01, 2012 12:06 pm, edited 1 time in total.
jospanner
Forum Members
Forum Members
Posts: 105
Joined: Tue Mar 25, 2008 11:34 pm

Re: problems with .htaccess

Post by jospanner »

Have you turned on mod_rewrite in the config?
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1975
Joined: Mon Jan 29, 2007 4:47 pm

Re: problems with .htaccess

Post by Jo Morg »

I may be wrong but I think you have to remove:

Code: Select all

RewriteBase /anafotia2012/
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post by georgechr »

Jo Morg wrote:I may be wrong but I think you have to remove:

Code: Select all

RewriteBase /anafotia2012/
Thanks for the reply. Removed it but nothing changed
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1975
Joined: Mon Jan 29, 2007 4:47 pm

Re: problems with .htaccess

Post by Jo Morg »

If your addon domain points to anafotia2012 it should work, unless your config.php has some wrong setting, at least AFAIK.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post by georgechr »

my addon points to public_html/anafotia2012

i havent changed anything else on my config.php except mod_rewrite
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: problems with .htaccess

Post by Dr.CSS »

This needs the last / removed...

RewriteBase /anafotia2012/

Should be...

RewriteBase /anafotia2012
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post 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?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1975
Joined: Mon Jan 29, 2007 4:47 pm

Re: problems with .htaccess

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1975
Joined: Mon Jan 29, 2007 4:47 pm

Re: problems with .htaccess

Post 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

Code: Select all

RewriteBase /anafotia2012/
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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
georgechr
Forum Members
Forum Members
Posts: 96
Joined: Tue Sep 13, 2011 6:02 am

Re: problems with .htaccess

Post 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
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1975
Joined: Mon Jan 29, 2007 4:47 pm

Re: problems with .htaccess

Post by Jo Morg »

NP.
Just add [Solved] at the beginning of the topic title. ;)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Locked

Return to “[locked] Installation, Setup and Upgrade”