Hi,
I'm new to CMS Made Simple and I'm running cmsmadesimple-1.5.1. My site was working perfectly and still is, but with one small problem. After enabling mod_rewrite to implement "pretty URL's" I can no longer access my admin section. When I browse to mydomain.com/admin I'm getting the custom error page I created.
I could access my admin section prior to enabling mod_rewrite and i've disabled it and can access the admin section again - so the problem is definitely to do with mod_rewrite. I've included my entire URL setting below.
#------------
#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'] = 'page';
Do I need to make some changes to the .htaccess file inside /admin? I'm guessing the solution is something small and simple! Any help with solving this issue is much appreciated. Thanks in advance
- Mahoo
Cannot access /admin after enabling mod_rewrite for "pretty" URL's
-
- New Member
- Posts: 4
- Joined: Wed Jan 14, 2009 6:33 pm
-
- New Member
- Posts: 4
- Joined: Wed Jan 14, 2009 6:33 pm
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
*UPDATE*
I have tried a few things and have pinned the problem down to the .htaccess file. Something that I neglected to mention was that I currently have the /admin directory password protected - put in place using CPanel (creates both .htaccess files in root and /admin).
With mod_rewrite enabled, here are my .htaccess files:
.htaccess file in root
.htaccess file in /admin
Note: I have also tried sticking in the content of the .htaccess file located in root in the one located in /admin - no luck.
Prior to enabling mod_rewrite I was prompted for a username and password when I browsed to mydomain.com/admin but after enabling mod_rewrite I was immediately presented with my custom error page. When I removed the password protection this I was able to access the /admin directory but obviously wasn't prompted for a password before the admin login page was displayed.
So, I suppose (could be wrong!) my problem now is how to get mod_rewrite to work correctly with an existing .htaccess file. Any takers? As always, any help is much appreciated.
- Mahoo
I have tried a few things and have pinned the problem down to the .htaccess file. Something that I neglected to mention was that I currently have the /admin directory password protected - put in place using CPanel (creates both .htaccess files in root and /admin).
With mod_rewrite enabled, here are my .htaccess files:
.htaccess file in root
Code: Select all
AuthUserFile "/home/mydomain/.htpasswds/public_html/mydomain/passwd"
AuthName "Authorised Users Only!"
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^start$ "http\:\/\/mydomain\.com\" [R=301,L]
Options +FollowSymLinks
RewriteEngine on
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 ^(.+).html$ index.php?page=$1 [QSA]
Code: Select all
AuthType Basic
AuthName "Administration"
require valid-user
AuthUserFile "/home/mydomain/.htpasswds/public_html/mydomain/admin/passwd"
Prior to enabling mod_rewrite I was prompted for a username and password when I browsed to mydomain.com/admin but after enabling mod_rewrite I was immediately presented with my custom error page. When I removed the password protection this I was able to access the /admin directory but obviously wasn't prompted for a password before the admin login page was displayed.
So, I suppose (could be wrong!) my problem now is how to get mod_rewrite to work correctly with an existing .htaccess file. Any takers? As always, any help is much appreciated.
- Mahoo
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
Hello,
have you tried the provided .htaccess sample ?
Pierre M.
have you tried the provided .htaccess sample ?
Pierre M.
-
- New Member
- Posts: 4
- Joined: Wed Jan 14, 2009 6:33 pm
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
Hi Pierre,
Sorry, I have been offline for a couple of days. Thank you for your response.
- Mahoo
Sorry, I have been offline for a couple of days. Thank you for your response.
Apologies in advance, but I'm not sure what you mean. What provided .htacccess sample are you referring to?have you tried the provided .htaccess sample ?
- Mahoo
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
The one listed here: http://wiki.cmsmadesimple.org/index.php ... ty_URL.27s
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
The one in the /doc directory 

-
- New Member
- Posts: 4
- Joined: Wed Jan 14, 2009 6:33 pm
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
Hi tyman00 and Pierre,
Thanks for pointing that out guys. Em, I've already said that I had included that content in my .htaccess file! Jeez, I know my posts are long - but did you guys even read them
hehe
I need to get my mod_rewrite .htaccess file to work with a password protected directory. See *UPDATE*
- Mahoo
Thanks for pointing that out guys. Em, I've already said that I had included that content in my .htaccess file! Jeez, I know my posts are long - but did you guys even read them

I need to get my mod_rewrite .htaccess file to work with a password protected directory. See *UPDATE*
- Mahoo
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
Try to put your rewriting .htaccess in the main directory and the password protecting .htaccess in the /admin directory under it.
Pierre M.
Pierre M.
Re: Cannot access /admin after enabling mod_rewrite for "pretty" URL's
I had the same problem, and found the solution here:
http://forum.cmsmadesimple.org/index.ph ... 659.0.html
Creating a blank file named 401.shtml in the public_html folder fixed it. Hope this helps...
http://forum.cmsmadesimple.org/index.ph ... 659.0.html
Creating a blank file named 401.shtml in the public_html folder fixed it. Hope this helps...