Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: peppemania on February 15, 2013, 10:48:47

Title: htaccess redirect with trailing slash
Post by: peppemania on February 15, 2013, 10:48:47
how can I redirect url with trailing slash?

elxis correctly generates the trailing slash, but if someone writes the URL without the slash, elxis generates 404 error.

the problem does not occur with the search engines, but only if users write the url in the wrong way (without trailing slash).

I have tried different solutions with htaccess, but the redirect does not work.

example :www.mysite.com/category/ (elxis correctly generates the trailing slash)
if i write www.mysite.com/category (error 404)

how can redirect automatically with trailing slash?

Title: Re: htaccess redirect with trailing slash
Post by: CREATIVE Options on February 15, 2013, 11:26:22
I hope that will help you.

Code: [Select]
//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com[nc]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]

//301 Redirect Entire Directory
RedirectMatch 301 oldcategory(.*) newdirectory/$1