redirect if url contains uppercase
7 posts
• Page 1 of 1
redirect if url contains uppercase
Hi all
im trying to create a rule that checks the url and if it contains upper case characters redirect them to the same url but all in lowercase.
can anyone help
im trying to create a rule that checks the url and if it contains upper case characters redirect them to the same url but all in lowercase.
can anyone help
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: redirect if url contains uppercase
Hello,
You'd need to use CL-flag.
So the rule would look like:
Regards
Andrew
You'd need to use CL-flag.
CL (Case Lower)
Changes the case of substitution result to lower
So the rule would look like:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteRule (.*[A-Z].*) /$1 [CL,R=301,L]
Regards
Andrew
Re: redirect if url contains uppercase
Hi thanks for that
im using the following code
RewriteEngine on
RewriteBase /
RewriteRule (.*[A-Z].*) /$1 [CL,R=301,L]
RewriteRule ^/sitemap$ /index.php?params=sitemap [NC,L,I]
so if I browse to www.mysite.com/SITEMAP it redirects to www.mysite.com/sitemap but then can't find the page index.php
im using the following code
RewriteEngine on
RewriteBase /
RewriteRule (.*[A-Z].*) /$1 [CL,R=301,L]
RewriteRule ^/sitemap$ /index.php?params=sitemap [NC,L,I]
so if I browse to www.mysite.com/SITEMAP it redirects to www.mysite.com/sitemap but then can't find the page index.php
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: redirect if url contains uppercase
Strange, shouldn't be this way.
Ty to enable logging and provide us with rewrite.log for a testing request. Logging issues are described here - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Ty to enable logging and provide us with rewrite.log for a testing request. Logging issues are described here - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Re: redirect if url contains uppercase
hi log output as requested, thanks for the help by the way
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'SITEMAP'
(1) escaping /sitemap
(2) explicitly forcing redirect with http://192.168.50.2/sitemap
(2) internal redirect with /SITEMAP [INTERNAL REDIRECT]
(2) init rewrite engine with requested uri /sitemap
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'sitemap'
(3) applying pattern '^/sitemap$' to uri 'sitemap'
(2) init rewrite engine with requested uri /favicon.ico
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'favicon.ico'
(3) applying pattern '^/sitemap$' to uri 'favicon.ico'
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'SITEMAP'
(1) escaping /sitemap
(2) explicitly forcing redirect with http://192.168.50.2/sitemap
(2) internal redirect with /SITEMAP [INTERNAL REDIRECT]
(2) init rewrite engine with requested uri /sitemap
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'sitemap'
(3) applying pattern '^/sitemap$' to uri 'sitemap'
(2) init rewrite engine with requested uri /favicon.ico
(1) Htaccess process request D:\inetpub\wwwroot\test\httpd.conf
(3) applying pattern '(.*[A-Z].*)' to uri 'favicon.ico'
(3) applying pattern '^/sitemap$' to uri 'favicon.ico'
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: redirect if url contains uppercase
Here's the answer:
You see the '/' in the pattern? Just remove it from the rule.
Regards
Andrew
(3) applying pattern '^/sitemap$' to uri 'sitemap'
You see the '/' in the pattern? Just remove it from the rule.
Regards
Andrew
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 16 guests