Page 1 of 1

[Solved] Mod_rewrite problem: directory incorrectly followed by double slashes

Posted: Thu Oct 30, 2008 12:54 pm
by technista
I have cmsms installed in the directory "sandbox". Since enabling mod_rewrite, my urls look like this:

http://domain.com/sandbox//

and the internal links look like this:

http://domain.com/sandbox//page.html

What is causing this extra slash to appear?

Here is the .htaccess file:

# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off
#


Options -Indexes
ServerSignature Off
Options +FollowSymLinks
#

RewriteEngine on
#
#Sub-dir e.g: /cmsms/
RewriteBase /sandbox/
#
# 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 ^(.+)$ index.php?page=$1 [QSA]





Here are the url settings of the config.php file:


#------------
#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';



Any help would be appreciated. Thanks.

Re: Mod_rewrite problem: directory incorrectly followed by double slashes

Posted: Thu Oct 30, 2008 1:40 pm
by alby
technista wrote: I have cmsms installed in the directory "sandbox". Since enabling mod_rewrite, my urls look like this:

http://domain.com/sandbox//
$config['root_url'] has a final slash?

Alby

Re:Mod_rewrite problem: directory incorrectly followed by double slashes

Posted: Thu Oct 30, 2008 11:09 pm
by technista
I found a fix. I went to config.php and removed the single slash after /sandbox in the URL settings. Thanks Alby for pointing me in that direction.