[TYPO3-linux] Fwd: Path rewrites
Chuku Balentina
chuku at netcreators.nl
Wed Oct 7 17:04:41 CEST 2015
In case someone else ran into this problem the solution is as follow:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*).html
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.domain.nl/$1/ [L,R=301]
On 06/10/15 11:24, Chuku Balentina wrote:
> 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
>
>
> _______________________________________________
> TYPO3-linux mailing list
> TYPO3-linux at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-linux
More information about the TYPO3-linux
mailing list