rewritemap
12 posts
• Page 1 of 1
rewritemap
I want to rewrite several seo-strings to a parameter query
At first I had rules beneath each other:
But that wasn't working with more than one rule.
Does anybody know why?
Now I want to use a map-file:
This works, but looks ugle with ten or more search-strings.
I have several url's like
They must be replaced with something like:
Does anybody know the general regexpr for the last "word" (from "/" until the end of the string)?
At first I had rules beneath each other:
- Code: Select all
RewriteEngine On
RewriteBase /
# if requested url-path without trailing slash does not exist as a file
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
# and if requested url-path plus a trailing slash does not exist as a directory
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
RewriteRule (/gardameer)?$ /nl/nl_object_alg.aspx?KeyID=GARDA [L]
RewriteRule (/vakantie_italie)?$ nl/nl_index.aspx [L]
RewriteRule (/residence_riai)?$ /nl/nl_object_alg.aspx?KeyID=RIAI [L]
But that wasn't working with more than one rule.
Does anybody know why?
Now I want to use a map-file:
- Code: Select all
RewriteMap seomap txt:"C:\Program Files\Helicon\ISAPI_Rewrite3\map.txt"
RewriteRule (gardameer|residence_riai)?$ ${seomap:$1} [L]
This works, but looks ugle with ten or more search-strings.
I have several url's like
- Code: Select all
http://www.example.com/gardameer
They must be replaced with something like:
- Code: Select all
http://www.example.com/nl/index.aspx?id=GARDA
Does anybody know the general regexpr for the last "word" (from "/" until the end of the string)?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
Hello,
Everything is correct. One RewriteCond acoompanies only one rule. So in your case you'd need
It's not the best practice to use a general rule, you may end up with a set of 10 rules for 10-level keyword URL. This proved to be more reliable.
Regards
Andrew
But that wasn't working with more than one rule.
Does anybody know why?
Everything is correct. One RewriteCond acoompanies only one rule. So in your case you'd need
- Code: Select all
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
RewriteRule (/gardameer)?$ /nl/nl_object_alg.aspx?KeyID=GARDA [L]
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
RewriteRule (/vakantie_italie)?$ nl/nl_index.aspx [L]
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
RewriteRule (/residence_riai)?$ /nl/nl_object_alg.aspx?KeyID=RIAI [L]
Does anybody know the general regexpr for the last "word" (from "/" until the end of the string)?
It's not the best practice to use a general rule, you may end up with a set of 10 rules for 10-level keyword URL. This proved to be more reliable.
Regards
Andrew
Re: rewritemap
Thank you for your reply.
But when I have a general regex for "the last word" from "/" till end, I should be able to use RewriteMap isn't it?
But when I have a general regex for "the last word" from "/" till end, I should be able to use RewriteMap isn't it?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
I don't see the reason why you couldn't.
Regards
Andrew
Regards
Andrew
Re: rewritemap
I still have problems using RewriteRule.
I have the following rules:
I get no response (page not found) with the following url in the adres-field of he browser:
http://www.italsol.nl/nl/residence_riai
What am I doing wrong?
I have the following rules:
- Code: Select all
# if requested url-path without trailing slash does not exist as a file
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
# and if requested url-path plus a trailing slash does not exist as a directory
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
...
RewriteRule (.*)/nl/residence_riai$ $1/nl/nl_object_alg.aspx?KeyID=RIAI [L]
...
RewriteRule (.*)/de/residence_riai$ $1/de/de_object_alg.aspx?KeyID=RIAI [L]
I get no response (page not found) with the following url in the adres-field of he browser:
http://www.italsol.nl/nl/residence_riai
What am I doing wrong?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
To see the issue we need to see the rewrite.log for the testing request.
Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Logging issues are described in FAQ - http://www.helicontech.com/forum/10648-FAQ.html
Regards
Andrew
Re: rewritemap
I finally found a usefull piece of the logging:
I used the following script:
I put the request:
This results in the error:
This is the logging result:
What am I doing wrong?
I used the following script:
- Code: Select all
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.98
RewriteEngine On
RewriteBase /
#enabling rewrite.log
RewriteLogLevel 9
#enabling error.log
LogLevel debug
RewriteLog "C:\Program Files\Helicon\ISAPI_Rewrite3\Rewrite.log"
# if requested url-path without trailing slash does not exist as a file
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
# and if requested url-path plus a trailing slash does not exist as a directory
RewriteCond %{DOCUMENT_ROOT}/$1/ !-d
# RewriteMap seomap txt:"C:\Program Files\Helicon\ISAPI_Rewrite3\map.txt"
# RewriteRule [a-z_]*$ ${seomap:$1} [L]
RewriteRule (.*)/nl/residence_riai$ $1/nl/nl_object_alg.aspx?KeyID=RIAI [L]
RewriteRule (.*)/vakantie_italie$ $1/nl_index.aspx [L]
RewriteRule (.*)/gardameer$ $1/nl_object_alg.aspx?KeyID=GARDA [L]
RewriteRule (.*)/vakantie_woning$ $1/nl_object_alg.aspx?KeyID=R6_0 [L]
RewriteRule (.*)/vakantie_villa$ $1/nl_object_alg.aspx?KeyID=RV [L]
RewriteRule (.*)/vakantie_appartement$ $1/nl_object_alg.aspx?KeyID=RK [L]
RewriteRule (.*)/nl/casa_yolanda$ $1/nl/nl_object_alg.aspx?KeyID=Y1 [L]
RewriteRule (.*)/nl/san_giorgio$ $1/nl_object_alg.aspx?KeyID=SG [L]
RewriteRule (.*)/vakantie_bungalow$ $1/nl_object_alg.aspx?KeyID=BF [L]
RewriteRule (.*)/nl/camping_sereno$ $1/nl/nl_object_alg.aspx?KeyID=SER [L]
RewriteRule (.*)/stacaravan$ $1/nl_object_alg.aspx?KeyID=SER&Tab=2 [L]
RewriteRule (.*)/golf$ $1/nl_object_alg.aspx?KeyID=GOLF [L]
RewriteRule (.*)/de/residence_riai$ $1/de/de_object_alg.aspx?KeyID=RIAI [L]
RewriteRule (.*)/ferien_italien$ $1/de_index.aspx [L]
RewriteRule (.*)/gardasee$ $1/de_object_alg.aspx?KeyID=GARDA [L]
RewriteRule (.*)/ferien_wohnung$ $1/de_object_alg.aspx?KeyID=R6_0 [L]
RewriteRule (.*)/ferien_villa$ $1/de_object_alg.aspx?KeyID=RV [L]
RewriteRule (.*)/ferien_appartement$ $1/de_object_alg.aspx?KeyID=RK [L]
RewriteRule (.*)/de/casa_yolanda$ $1/de/de_object_alg.aspx?KeyID=Y1 [L]
RewriteRule (.*)/de/san_giorgio$ $1/de/de_object_alg.aspx?KeyID=SG [L]
RewriteRule (.*)/ferien_bungalow$ $1/de_object_alg.aspx?KeyID=BF [L]
RewriteRule (.*)/de/camping_sereno$ $1/de/de_object_alg.aspx?KeyID=SER [L]
RewriteRule (.*)/mobil_home$ $1/de_object_alg.aspx?KeyID=SER&Tab=2
I put the request:
- Code: Select all
http://www.italsol.com/nl/residence_riai
This results in the error:
- Code: Select all
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
This is the logging result:
- Code: Select all
(2) init rewrite engine with requested uri /nl/residence_riai
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '(.*)/nl/residence_riai$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/vakantie_italie$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/gardameer$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/vakantie_woning$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/vakantie_villa$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/vakantie_appartement$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/nl/casa_yolanda$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/nl/san_giorgio$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/vakantie_bungalow$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/nl/camping_sereno$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/stacaravan$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/golf$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/de/residence_riai$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/ferien_italien$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/gardasee$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/ferien_wohnung$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/ferien_villa$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/ferien_appartement$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/de/casa_yolanda$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/de/san_giorgio$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/ferien_bungalow$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/de/camping_sereno$' to uri 'nl/residence_riai'
(3) applying pattern '(.*)/mobil_home$' to uri 'nl/residence_riai'
What am I doing wrong?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
Hello,
I edited your log to make it readable for everyone.The following illustrates the issue:
All you need to do is at least get rid of the '/' in front of the pattern in your rule - it's the reason why it doesn't match the request.
Regards
Andrew
I edited your log to make it readable for everyone.The following illustrates the issue:
(3) applying pattern '(.*)/nl/residence_riai$' to uri 'nl/residence_riai'
All you need to do is at least get rid of the '/' in front of the pattern in your rule - it's the reason why it doesn't match the request.
Regards
Andrew
Re: rewritemap
Thank you for your answer.
I changed the rule
into
I still get "HTTP Error 404 - File or directory not found.".
I found this in the logging:
What did I do wrong?
I changed the rule
- Code: Select all
RewriteRule (.*)/nl/residence_riai$ $1/nl/nl_object_alg.aspx?KeyID=RIAI [L]
into
- Code: Select all
RewriteRule (.*)nl/residence_riai$ $1nl/nl_object_alg.aspx?KeyID=RIAI [L]
I still get "HTTP Error 404 - File or directory not found.".
I found this in the logging:
- Code: Select all
(2) init rewrite engine with requested uri /nl/residence_riai
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '(.*)nl/residence_riai$' to uri 'nl/residence_riai'
(4) RewriteCond: input='c:\inetpub\wwwroot\/' pattern='!!-f' => matched
(4) RewriteCond: input='c:\inetpub\wwwroot\//' pattern='!!-d' => not-matched
(3) applying pattern '(.*)/vakantie_italie$' to uri 'nl/residence_riai'
What did I do wrong?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
Hello,
Probably there's a physical folder with a name "residence_riai"
Or you don't have permissions adjusted.
Regards
Andrew
Probably there's a physical folder with a name "residence_riai"
Or you don't have permissions adjusted.
Regards
Andrew
Re: rewritemap
Hello,
I have checked, there isn't an folder inetpub\wwwroot\nl\residence_riai.
What do you mean with "permissions adjusted".
Which persmissions must be adjusted?
Regards Cees
I have checked, there isn't an folder inetpub\wwwroot\nl\residence_riai.
What do you mean with "permissions adjusted".
Which persmissions must be adjusted?
Regards Cees
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: rewritemap
You can learn more about permissions here - http://www.helicontech.com/isapi_rewrite/doc/security.htm
The idea is that ISAPI_Rewrite doesn't have permissions to list folder content and see if a file or folder is real or not. You need to grant permissions to the user that runs the site's app pool OR/and you can grant permissions to INTERNET_SERVICE.
Regards
Andrew
The idea is that ISAPI_Rewrite doesn't have permissions to list folder content and see if a file or folder is real or not. You need to grant permissions to the user that runs the site's app pool OR/and you can grant permissions to INTERNET_SERVICE.
Regards
Andrew
12 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests