Rewrite rule for URLs ending in dots
5 posts
• Page 1 of 1
Rewrite rule for URLs ending in dots
Hi,
We have a really old website with dead linkthroughs coming from other websites. The links are dead because the coders for these external websites are somewhat retarded. Anyway, how do I redirect a request for:
http://www.mydomain.com/dead_link...
to http://www.mydomain.com/the-actual-url/
I've tried RewriteRule ^dead_link(.+)$ http://www.mydomain.com/the-actual-url/ [NC,R=301,L] but it didn't work.
Cheers!
We have a really old website with dead linkthroughs coming from other websites. The links are dead because the coders for these external websites are somewhat retarded. Anyway, how do I redirect a request for:
http://www.mydomain.com/dead_link...
to http://www.mydomain.com/the-actual-url/
I've tried RewriteRule ^dead_link(.+)$ http://www.mydomain.com/the-actual-url/ [NC,R=301,L] but it didn't work.
Cheers!
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite rule for URLs ending in dots
Hello,
The dots are supposed to be escaped, although your rule also could be applied.
The reason it didn't work can be figured out from logs. Simply enable logs as described in FAQ and provide us with the log for the testing request.
Regards
Andrew
The dots are supposed to be escaped, although your rule also could be applied.
The reason it didn't work can be figured out from logs. Simply enable logs as described in FAQ and provide us with the log for the testing request.
Regards
Andrew
Re: Rewrite rule for URLs ending in dots
Thanks Andrew,
There is nothing in the logs about this redirect (log level is set to 9). The error I'm getting is:
We are on a Windows Server 2008 R2 machine running IIS 7.5.
There is nothing in the logs about this redirect (log level is set to 9). The error I'm getting is:
- Code: Select all
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /dead_link...
We are on a Windows Server 2008 R2 machine running IIS 7.5.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewrite rule for URLs ending in dots
It's states in FAQ that ISAPI_Rewrite has its own logs in Helicon installation folder, called rewrite.log and error.log.
Regards
Andrew
Regards
Andrew
Re: Rewrite rule for URLs ending in dots
Logging is enabled and set to level 9 and has been working fine for months.
However, this particular error (redirecting a ... URL) will not be found in the Isapi Rewrite logs because the request is handled and processed by IIS and is not even passed to Isapi Rewrite. Since posting here I've found out that IIS does not like unconventional file extensions and maps and will by default handle these with its own 404 application error page. The way around this is to add the following line to the web.config file:
After that, the rewrite rule works fine! Cheers...
However, this particular error (redirecting a ... URL) will not be found in the Isapi Rewrite logs because the request is handled and processed by IIS and is not even passed to Isapi Rewrite. Since posting here I've found out that IIS does not like unconventional file extensions and maps and will by default handle these with its own 404 application error page. The way around this is to add the following line to the web.config file:
- Code: Select all
<system.web>
<httpRuntime relaxedUrlToFileSystemMapping="true" />
</system.web>
After that, the rewrite rule works fine! Cheers...
- Code: Select all
RewriteRule ^dead_link(.+)$ http://www.mydomain.com/the-actual-url/ [NC,R=301,L]
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests