removing forward slash after 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
JaymeNYC
Forum Members
Forum Members
Posts: 53
Joined: Sat Aug 30, 2008 8:30 pm

removing forward slash after url

Post by JaymeNYC »

I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?
alby

Re: removing forward slash after url

Post by alby »

JaymeNYC wrote: I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?
Change to empty in config.php: $config['page_extension'] = '';
and check in accord your .htaccess

Alby
JaymeNYC
Forum Members
Forum Members
Posts: 53
Joined: Sat Aug 30, 2008 8:30 pm

Re: removing forward slash after url

Post by JaymeNYC »

alby wrote:
JaymeNYC wrote: I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?
Change to empty in config.php: $config['page_extension'] = '';
and check in accord your .htaccess

Alby
I have the config set up like you said above and this is my .htaccess

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 ^(.+)$ index.php?page=$1 [QSA]

what would I change?
Pierre M.

Re: removing forward slash after url

Post by Pierre M. »

Hello,
JaymeNYC wrote: I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?
JaymeNYC wrote: # 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]
You don't want trailing slashes ? You are right , btw. Just don't activate them.
I agree there is some problem with the currently shipped htaccess sample. The past sample hadn't this... flaw.
Just throw away those nasty 3 trailing slash adding lines.

Pierre M.
JaymeNYC
Forum Members
Forum Members
Posts: 53
Joined: Sat Aug 30, 2008 8:30 pm

Re: removing forward slash after url

Post by JaymeNYC »

Pierre M. wrote: Hello,
JaymeNYC wrote: I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?
JaymeNYC wrote: # 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]
Thx! after removing the 3 lines above it works without the trailing slash, but the trailing slash still works is there a way I can redirect the url with the trailing slash to the url without it?

You don't want trailing slashes ? You are right , btw. Just don't activate them.
I agree there is some problem with the currently shipped htaccess sample. The past sample hadn't this... flaw.
Just throw away those nasty 3 trailing slash adding lines.

Pierre M.
Pierre M.

Re: removing forward slash after url

Post by Pierre M. »

JaymeNYC wrote: Thx! after removing the 3 lines above it works without the trailing slash, but the trailing slash still works is there a way I can redirect the url with the trailing slash to the url without it?
What about

Code: Select all

$config['page_extension'] = '.html';
?
See http://wiki.cmsmadesimple.org/index.php ... l_Settings

Pierre
Locked

Return to “CMSMS Core”