Page 1 of 1

removing forward slash after url

Posted: Mon Oct 27, 2008 7:30 pm
by JaymeNYC
I'm currently getting "www.site.com/subpage/" but I would rather have "www.site.com/subpage" how do I do this?

Re: removing forward slash after url

Posted: Mon Oct 27, 2008 7:34 pm
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

Re: removing forward slash after url

Posted: Mon Oct 27, 2008 10:25 pm
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?

Re: removing forward slash after url

Posted: Tue Oct 28, 2008 4:41 pm
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.

Re: removing forward slash after url

Posted: Tue Oct 28, 2008 9:21 pm
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.

Re: removing forward slash after url

Posted: Wed Oct 29, 2008 8:35 pm
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