[solved] mod_rewrite errors (clean URLs)
Posted: Fri Jan 26, 2007 1:34 pm
[problem]
I'm attempting to set up a siteto use clean URLS, and have followed the instructions for both .htaccess and config.php.
Here's the .htaccess of the root directory (the site is installed within a directory named "site")
Options +FollowSymLinks
RewriteEngine on
RewriteBase /site/
# 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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
And the config.php URL settings:
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '/';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
Attempting to access the site results in a 500 Internal Server Error and the server log returns four instances of the following error:
RewriteCond: bad argument line '%{REQUEST_URI}\xca!/$'\n
mod_rewrite is active on the server.
Any ideas?
[solution]
The problem lay in the space characters introduced by copying from the CMSMS site and pasting in to my .htaccess file. Backspacing over and re-entering the spaces did the job.
I'm attempting to set up a siteto use clean URLS, and have followed the instructions for both .htaccess and config.php.
Here's the .htaccess of the root directory (the site is installed within a directory named "site")
Options +FollowSymLinks
RewriteEngine on
RewriteBase /site/
# 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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
And the config.php URL settings:
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '/';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
Attempting to access the site results in a 500 Internal Server Error and the server log returns four instances of the following error:
RewriteCond: bad argument line '%{REQUEST_URI}\xca!/$'\n
mod_rewrite is active on the server.
Any ideas?
[solution]
The problem lay in the space characters introduced by copying from the CMSMS site and pasting in to my .htaccess file. Backspacing over and re-entering the spaces did the job.