[TYPO3-linux] Fwd: Path rewrites

Chuku Balentina chuku at netcreators.nl
Tue Oct 6 11:24:48 CEST 2015


Hi,

I'm having a problem with some path rewrites. I want to rewrite a 
portion of a path in a url regardless where it's found in a URL.
E.g. http://domain.com/some/path/to/*rewrite*/end.html will be rewritten 
to http://domain.com/some/path/to/*newpath*/end.html

I'm using the following code which works fine when the path to be 
rewritten is between slashes.
RedirectMatch 301 (.*)/rewrite/(.*) $1/newpath/$2

But if my URL looks like this "http://domain.com/some/path/to/*rewrite" 
*it won't work because of the missing trailing slash.
Is there a way to add the trailing slash only when the url does not end 
with *.html.

i tried using the code below but it doe snot work.

#Trailing slash check
RewriteCond %{REQUEST_URI} !(.*)/$
#Add slash if missing & redirect
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(.*)$ /$1 [L,QSA]

Cheers
Chuku




More information about the TYPO3-linux mailing list