Grouping Redirects By Domain
6 posts
• Page 1 of 1
Grouping Redirects By Domain
When setting up redirects with helicon ape for a CMS that has multiple domain names that pull up different contect, is there a way in the .htaccess file to group statements. For example, on a site with a CMS installed, I have the following domains setup:
domaina.com
domainb.com
Currently if I want to put in different redirect rules for each domain, I have to do something like:
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
It would be nice if I could do something like:
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
{
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
}
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
{
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
}
Is there a way to implement something like this in helicon ape so I can group all the redirect rules for specific domains into one group. It would make it easier to manage as well as reduce the size of the .htaccess file.
domaina.com
domainb.com
Currently if I want to put in different redirect rules for each domain, I have to do something like:
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
It would be nice if I could do something like:
RewriteCond %{HTTP_HOST} ^www.domaina.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domaina.com$ [NC]
{
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
}
RewriteCond %{HTTP_HOST} ^www.domainb.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domainb.com$ [NC]
{
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
}
Is there a way to implement something like this in helicon ape so I can group all the redirect rules for specific domains into one group. It would make it easier to manage as well as reduce the size of the .htaccess file.
Re: Grouping Redirects By Domain
Hello,
As far as I understand, you put all these rules into httpd.conf file.
In this case you can use <VirtualHost> sections to group rules like this:
<VirtualHost www.domaina.com domaina.com>
RewriteEngine On
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
</VirtualHost>
<VirtualHost www.domainb.com domainb.com>
RewriteEngine On
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
</VirtualHost>
As far as I understand, you put all these rules into httpd.conf file.
In this case you can use <VirtualHost> sections to group rules like this:
<VirtualHost www.domaina.com domaina.com>
RewriteEngine On
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
</VirtualHost>
<VirtualHost www.domainb.com domainb.com>
RewriteEngine On
RewriteRule ^PathToLookFor$ /this/is/where/you/go [R=301,NC,L]
RewriteRule ^NewPathToLookFor$ /go/here/instead [R=301,NC,L]
</VirtualHost>
Re: Grouping Redirects By Domain
This is for Helicon Ape on a windows server and we cannot update the httpd.conf file which is for Apache. The following does not appear to work in the .htaccess file:
<VirtualHost www.domaina.com domaina.com>
RewriteEngine On
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
</VirtualHost>
<VirtualHost www.domaina.com domaina.com>
RewriteEngine On
RewriteRule ^SomePathToLookFor$ / [R=301,NC,L]
RewriteRule ^SomeDifferentPathToLookFor$ /go/here [R=301,NC,L]
</VirtualHost>
Re: Grouping Redirects By Domain
Hello,
"This is for Helicon Ape on a windows server and we cannot update the httpd.conf file which is for Apache."
- sorry, didn't quite understand you. Both httpd.conf and .htaccess are using in Helicon Ape as well as in Apache. You are using Helicon Ape, right? Why would you need to use VirtualHost directive in .htaccess which is already a per-site configuration file? Simply put the rules for domain A into .htaccess in the root of domainA and the rules for domain B into the .htaccess in the root of domainB.
"This is for Helicon Ape on a windows server and we cannot update the httpd.conf file which is for Apache."
- sorry, didn't quite understand you. Both httpd.conf and .htaccess are using in Helicon Ape as well as in Apache. You are using Helicon Ape, right? Why would you need to use VirtualHost directive in .htaccess which is already a per-site configuration file? Simply put the rules for domain A into .htaccess in the root of domainA and the rules for domain B into the .htaccess in the root of domainB.
Re: Grouping Redirects By Domain
The issue is that the this is for a CMS which has multiple domain portals on it. The CMS knows which site to pull up based on the domain that was provided. In this case, there are 4 domain names that point to different portals within the same CMS. We are wanting to be able to group the redirect rules by domain in the .htaccess file so the redirects for 1 domain will not effect the other domains.
Re: Grouping Redirects By Domain
Does anyone know if this is possible with the current Helicon Ape? I can open a paid support ticket if that will help get an answer or a fix for what I am trying to do....
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 39 guests