Converting mod_rewrite rules!
10 posts
• Page 1 of 1
- mikelovell
- Posts: 5
- Joined: 03 Jan 2013, 22:33
Converting mod_rewrite rules!
I have some rules given to me from mod_rewrite on Linux, but I cannot seem to even get past the first rule:
Basically if it's a mobile user agent and /mobile/index.html exists, redirect to mobile.<domain> URL.
Both these rules just give me invalid sting:
I'm probably doing something very basic wrong here, any ideas?
Thanks,
- Code: Select all
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteCond %{ENV:ENVDOCROOTDIR}/mobile/index.html -f
RewriteRule .* http://mobile.%{ENV:ENVDNAME}/ [R=302,L,NC]
Basically if it's a mobile user agent and /mobile/index.html exists, redirect to mobile.<domain> URL.
Both these rules just give me invalid sting:
- Code: Select all
[ISAPI_Rewrite]
RewriteCond User-Agent: android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos
RewriteCond User-Agent: (android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos)
I'm probably doing something very basic wrong here, any ideas?
Thanks,
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting mod_rewrite rules!
Hello,
I guess what you do is just edit the conditions, not the rule.
The three lines of original code you provided are a single rule with 2 conditions. The resulting lines represent only the conditions, not the rule.
Sorry if I misunderstood you.
Regards
Andrew
I guess what you do is just edit the conditions, not the rule.
The three lines of original code you provided are a single rule with 2 conditions. The resulting lines represent only the conditions, not the rule.
Sorry if I misunderstood you.
Regards
Andrew
- mikelovell
- Posts: 5
- Joined: 03 Jan 2013, 22:33
Re: Converting mod_rewrite rules!
I'm trying to edit the conditions but it just gives me invalid string. I can't even get past the conditions and onto the rule.
What I posted was an example of the two conditions I tried, both failed.
I haven't got a complete condition/rule set for this, as I have no idea how to do it!
What I posted was an example of the two conditions I tried, both failed.
I haven't got a complete condition/rule set for this, as I have no idea how to do it!
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting mod_rewrite rules!
Please, provide more information: what error do you get? where do you post the rule?
I could be that you simply installed ISAPI_Rewrite 3 and trying to use v2 syntax
Regards
Andrew
I could be that you simply installed ISAPI_Rewrite 3 and trying to use v2 syntax
Regards
Andrew
- mikelovell
- Posts: 5
- Joined: 03 Jan 2013, 22:33
Re: Converting mod_rewrite rules!
I decided to cut my loses and install v3 instead (it was definitely v2 being used before), but now a new problem.
Every time I hit the page "httpd.parse.errors" is generated, but it's empty, and I know there are errors in it, because it is thus:
Ideas?
Every time I hit the page "httpd.parse.errors" is generated, but it's empty, and I know there are errors in it, because it is thus:
- Code: Select all
RewriteEngine On
RewriteLogLevel 9
LogLevel debug
RewriteCond THIS IS DEFINITION AN ERROR IN MY CONFIG (#$&(&$(*#&($*@$
Ideas?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting mod_rewrite rules!
Hm.. httpd.parse.errors is not our file.
I'm afraid the problem is not quite clear. Please, provide the rule, the testing request and the rewrite.log and error.log for the testing request.
Logging issues described in FAQ
Regards
Andrew
I'm afraid the problem is not quite clear. Please, provide the rule, the testing request and the rewrite.log and error.log for the testing request.
Logging issues described in FAQ
Regards
Andrew
- mikelovell
- Posts: 5
- Joined: 03 Jan 2013, 22:33
Re: Converting mod_rewrite rules!
Hrm, odd, something is creating it, I thought this file was ISAPI Rewrites because of the documentation:
http://www.isapirewrite.com/docs/
... "That will allow creation of httpd.parse.errors files containing config files parsing errors. " ...
http://www.isapirewrite.com/docs/
... "That will allow creation of httpd.parse.errors files containing config files parsing errors. " ...
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting mod_rewrite rules!
This file is meant for ISAPI_Rewrite 2, while you said you installed ISAPI_Rewrite 3. That's the reason I suggested FAQ, which describes the logging issue for ISAPI_Rewrite 3. Note that ISAPI_Rewrite 2 and 3 can not be installed at the same time.
Regards
Andrew
Regards
Andrew
- mikelovell
- Posts: 5
- Joined: 03 Jan 2013, 22:33
Re: Converting mod_rewrite rules!
Okay, I've got the following in my global htttp.conf :
It's indicated that loading went correctly, from the global error.log:
There's a local httpd.conf file for a single domain, in its webroot, which still contains:
But no error log is produced there, and nothing is indicated in global.
- Code: Select all
#enabling rewrite.log
RewriteLogLevel 9
#enabling error.log
LogLevel debug
It's indicated that loading went correctly, from the global error.log:
- Code: Select all
[...] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
[...] ISAPI Filter loaded. Version 3.1.0.96. Windows 5.2 (Build 3790 ServicePack:2) ProductType SERVER. CPU type INTEL NumberOfProcessors 4.
There's a local httpd.conf file for a single domain, in its webroot, which still contains:
- Code: Select all
RewriteEngine On
RewriteLogLevel 9
LogLevel debug
RewriteCond THIS IS DEFINITION AN ERROR IN MY CONFIG (#$&(&$(*#&($*@$
But no error log is produced there, and nothing is indicated in global.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting mod_rewrite rules!
Hm.... you don't create httpd.conf for a single domain. httpd.conf is a server wide config file. If you want to use site-wide config - .htaccess is right for you.
Please, note the path of your server config file:
Also, please, clarify what is the following:
regards
Andrew
Please, note the path of your server config file:
C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
Also, please, clarify what is the following:
- Code: Select all
RewriteCond THIS IS DEFINITION AN ERROR IN MY CONFIG (#$&(&$(*#&($*@$
regards
Andrew
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests