Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

Redirect the subdomain to a parameter without a generic SSL certificate

0
0

I'm trying to do which might be not possible at all. Let's say I own mydomain.com and have standard (no wildcard) RapidSSL certificate which works for www.mydomain.com and mydomain.com .

I'd like to redirect (.htaccess) subdomain.mydomain.com to mydomain.com/?param=subdomain .

I already managed to redirect it to subdomain.mydomain.com/?param=subdomain but the problem is that on every redirection I get browser warning concerning my certificate which doesn't cover any subdomain.

Is it possible to redirect it without the warning? I need subdomain only for pretty passing the parameter and I don't need it after redirection.

I think you want to capture the subdomain in the URL as shown in the 2nd RewriteCond and then use it as the parameter value:

<IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !www.mydomain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).mydomain.com [NC] RewriteRule (.*)?param=%2/$1 [L] </IfModule>

This is a link to the above solution... http://www.mediacollege.com/internet/server/apache/mod-rewrite/subdomains.html

Hope this helps!


Viewing all articles
Browse latest Browse all 12749

Latest Images

Trending Articles





Latest Images