Invalid domain URL on redirect

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 9
Joined: 09 Aug 2012, 11:24

Invalid domain URL on redirect

21 Jun 2016, 21:53

I have a rule that redirects requests to a secondary domain name to the primary domain name. This works fine.

I also have a rule that takes the url string and checks to see if it not a file or directory, but does exist if I add a .cfm to the string, then redirect to that file. Basic SEO stuff. This works fine if I am on the primary domain.

However, if I make a request to an SEO URL on the secondary domain, I receive a 500 error. Here is the error:

(error) ape_module:28: 'http:/www.primarydomain.net/executive-search.cfm' is not a valid virtual path.

The original request is http:/www.secondarydomain.net/executive-search and the /executive-search.cfm file does exist and works fine if I request http:/www.primarydomain.net/executive-search. As you can see from the error, the URL that APE is trying to redirect to only has on forward slash after the http protocol.

Here is my .htaccess file:

---------------------------------------------------

SetEnvIf Host beta.primarydomain.net passreq

# Authentication type
AuthType Basic
# Name of area authentication will be used for (aka realm)
AuthName "Authorized Area"

# Authentication provider. Here - mod_authn_file
AuthBasicProvider file
# Info for mod_authn_file - path to password file
AuthUserFile C:\home\primarydomain.net\.htpasswds
# Access will be granted to all authenticated users
Require valid-user

Order allow,deny
Allow from all
Deny from env=passreq
Satisfy any

ErrorDocument 403 "Sorry, the access is forbidden"

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^(beta|localhost|www)\.primarydomain\.net$ [NC]
RewriteRule (.*) http://www.primarydomain.net/$1 [NC,R=301]

RewriteCond %{HTTP_HOST} ^beta\.primarydomain\.net$ [NC]
RewriteRule ^robots.txt$ robots-dev.txt [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.cfm -f
RewriteRule (.*) $1.cfm [NC,L,QSA]

---------------------------------------------------

I am using Ape version 3.1.0.248 on IIS 7.5. Any help would be much appreciated.

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: Invalid domain URL on redirect

29 Jun 2016, 07:18

Hello.

Colon is a special character in format string. Please alter your redirect rule as follows:

Code: Select all
RewriteCond %{HTTP_HOST} !^(beta|localhost|www)\.primarydomain\.net$ [NC]
RewriteRule (.*) http\://www.primarydomain.net/$1 [NC,R=301]

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 24 guests