How to get rid of the last "/" in Pretty URL

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
ironblaze94

How to get rid of the last "/" in Pretty URL

Post by ironblaze94 »

Hi, how do i get rid of the last forward slash "/" in my pretty url so instead of being shown as

http://site.com/link/link/

it is shown as

http://site.com/link/link

Thank You  ;D
Pierre M.

Re: How to get rid of the last "/" in Pretty URL

Post by Pierre M. »

Hello,
ironblaze94 wrote: Hi, how do i get rid of the last forward slash "/" in my pretty url
Short answer : don't append it. Use an rewriting scheme that fits your needs. (my pretty URLs are .html postfixed)

Some information about trailing slashes mess (in life and in the doc) :
http://forum.cmsmadesimple.org/index.ph ... l#msg64195

Have you tried the official provided .htaccess sample ?
See also http://wiki.cmsmadesimple.org/index.php ... l_Settings about site.net/parent/child

Pierre M.
ironblaze94

Re: How to get rid of the last "/" in Pretty URL

Post by ironblaze94 »

Hi Pierre

I did use the mod_rewrite straight out of the box, would you like me to post my .htaccess file?

I notice that the code given on this page http://wiki.cmsmadesimple.org/index.php ... retty_URLs for no file extention says the code will produce links similar to www.example.com/page1/page11/ which is what i get but i would like to know how to get rid of the last "/"

The CMSMS site doesn't have the last "/"
Last edited by ironblaze94 on Thu Apr 10, 2008 12:51 pm, edited 1 time in total.
ironblaze94

Re: How to get rid of the last "/" in Pretty URL

Post by ironblaze94 »

ok here is the .htaccess file

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

# Make sure you have Options FollowSymLinks
# and Allow on
RewriteEngine On

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 [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Pierre M.

Re: How to get rid of the last "/" in Pretty URL

Post by Pierre M. »

Pierre M. wrote:
ironblaze94 wrote: Hi, how do i get rid of the last forward slash "/" in my pretty url
Short answer : don't append it. Use an rewriting scheme that fits your needs. (my pretty URLs are .html postfixed)
ironblaze94 wrote: # 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
Pierre M. wrote: Have you tried the official provided .htaccess sample ?
See also http://wiki.cmsmadesimple.org/index.php ... l_Settings about site.net/parent/child
Don't append the trailing slash you don't want. Use the official provided stuff that works.

Pierre M.
Locked

Return to “CMSMS Core”