Pretty URL's SOLVED
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Pretty URL's SOLVED
Im struggling here with the pretty url's, in the config file I have this code:
#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'] = '.php';
#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';
And this have made my url's have the extension .php but the page does not exist, where have I gone wrong, each page now has the correct extension such as electrical.php but I get the error.
http://www.electrifire.co.uk/test
#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'] = '.php';
#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';
And this have made my url's have the extension .php but the page does not exist, where have I gone wrong, each page now has the correct extension such as electrical.php but I get the error.
http://www.electrifire.co.uk/test
Last edited by electrifire on Sat Apr 03, 2010 6:53 pm, edited 1 time in total.
Re: Pretty URL's
IMO you have misconfigured "/.htaccess". simply because site is in subdirectory. You edit it like this (i guess)
RewriteRule ^test/(.+)\.php$ index.php?page=$1 [QSA]
Re: Pretty URL's
Even simpler,
RewriteBase /yourfolder
I just answered this question yesterday somewhere else.
RewriteBase /yourfolder
I just answered this question yesterday somewhere else.
Last edited by replytomk3 on Fri Apr 02, 2010 6:30 am, edited 1 time in total.
Re: Pretty URL's
I believe it is actually RewriteBase /yourfolder w/o the / at the end...
From default htaccess file...
#Sub-dir e.g: /cmsms
RewriteBase /
From default htaccess file...
#Sub-dir e.g: /cmsms
RewriteBase /
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Re: Pretty URL's
Dr.CSS I'm afraid your post went over my head:
I didn't actually edit the .htaccess file I just edited the config file, the site is in a sub domain currently until I get it up and running properly on cmsms.
So I need to edit .htaccess file with RewriteBase /test?
I didn't actually edit the .htaccess file I just edited the config file, the site is in a sub domain currently until I get it up and running properly on cmsms.
So I need to edit .htaccess file with RewriteBase /test?
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Re: Pretty URL's
Ok it works as in the url is something like http://www.electrifire.co.uk/test/electrical.php
however I get this error form google when I click a link from the menu:
Oops! This link appears to be broken.
This is the contents of my .htaccess file:
SetEnv DEFAULT_PHP_VERSION 5
RewriteBase /test
Any other ideas?
however I get this error form google when I click a link from the menu:
Oops! This link appears to be broken.
This is the contents of my .htaccess file:
SetEnv DEFAULT_PHP_VERSION 5
RewriteBase /test
Any other ideas?
Re: Pretty URL's
No, it doesn't!electrifire wrote: Ok it works as in the url is something like http://www.electrifire.co.uk/test/electrical.php
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Re: Pretty URL's
hmmm please explain then as the fact the url has shortened and now has the .php extension made me think the mod rewrite was kind of working and the issue I had was the page is not actually at this new extension
Re: Pretty URL's
Post your config.php URL section and complete .htaccess here again. Is this Linux hosting?
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Re: Pretty URL's
Yes this is linux hosting and the sit is in a sub domain until I have everything up and running then I will replace my current site with cms.
This is the URL settings:
#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'] = '.php';
#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';
This is the contents of my .htaccess file:
SetEnv DEFAULT_PHP_VERSION 5
RewriteBase /test
This is the URL settings:
#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'] = '.php';
#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';
This is the contents of my .htaccess file:
SetEnv DEFAULT_PHP_VERSION 5
RewriteBase /test
Re: Pretty URL's
LOL
your htaccess should be
optional settings for security below SetEnv DEFAULT_PHP_VERSION 5:
your htaccess should be
Code: Select all
SetEnv DEFAULT_PHP_VERSION 5
ServerSignature Off
# Deny access to config.php
# This can be useful if php ever breaks or dies
# Use with caution, this may break other functions of CMSms that use a config.php
# file. This may also break other programs you have running under your CMSms
# install that use config.php. You may need to add another .htaccess file to those
# directories to specifically allow config.php.
<Files "config.php">
order allow,deny
deny from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms/
RewriteBase /test
# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering
# 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]
</IfModule>
Code: Select all
Options +FollowSymLinks
Options -Indexes
-
- Forum Members
- Posts: 48
- Joined: Sun Feb 28, 2010 3:53 pm
Re: Pretty URL's
hmmm should that code be in there to start with or should I have added it manually?
Thanks for the tip
Thanks for the tip
Re: Pretty URL's
for mod_rewrite to work, you must have all of that in your .htaccess
you must add it manually
read documentation next time. It will save everyone's time. Most importantly, yours.
you must add it manually
read documentation next time. It will save everyone's time. Most importantly, yours.
Re: Pretty URL's SOLVED
I have the same problem, and try all these things but it won't work. I get every time the "Not Found" Page.
CMSms is in the sub dir "cmsms"
.htaccess File
config.php
I have also tried your file, but even with this configuration the "Not Found" page appears
other information
mod_rewrite is enabled
.htaccess and config.php is readable
CMSms Version 1.7
The PHP Version is 5.2.10, recommend ist 5.2.12 but I don't think there is the problem...
CMSms is in the sub dir "cmsms"
.htaccess File
Code: Select all
# 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
# (this is important, so uncomment if your host permit)
#Options -Indexes
#ServerSignature Off
#
Options +FollowSymLinks
#
<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /cmsms
#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
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]
</IfModule>
Code: Select all
#------------
#URL Settings
#------------
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';
other information
mod_rewrite is enabled
.htaccess and config.php is readable
CMSms Version 1.7
The PHP Version is 5.2.10, recommend ist 5.2.12 but I don't think there is the problem...
Last edited by maxxbu on Sun Apr 04, 2010 4:27 pm, edited 1 time in total.