• 10

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

What I am trying to achieve is the following: I want to have numerous subdomains such as abc.domain.com redirect to a url such as www.domain.com/something?subdomain=abc

Since I am redirecting to a fully qualified domain, I needed to use a reverse proxy to avoid the change of the URL in the browser. (using the [P] Flag and turning on the mod_proxy module and some other modules)

This is my DNS setup

*.domain.com.   14400    A

This is my virtual host configuration for apache

    ServerName www.domain.com
    ServerAlias *.lionite.com
    DocumentRoot /var/www/html
    ErrorLog /var/www/logs
    UseCanonicalName off

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/images
RewriteCond   %{HTTP_HOST}      !^www\.domain\.com$
RewriteRule   ^(.+)     %{HTTP_HOST}$1          [C]
RewriteRule   ^([^.]+)\.domain\.com(.*) http://www.domain.com/something?subdomain=$1 [P,L]

This setup is working fine (Let me know if you think you can improve it of course).

My main problem is when I am trying to setup https://

This is my virtual host configuration for apache

ServerName www.domain.com:443
ServerAlias *.domain.com
DocumentRoot /var/www/html

SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/httpd/conf.d/cert/server.crt
SSLCertificateKeyFile /etc/httpd/conf.d/cert/server.key

<Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars

SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/images
    RewriteCond   %{HTTPS_HOST}      !^www\.domain\.com$
    RewriteRule   ^(.+)     %{HTTPS_HOST}$1          [C]
    RewriteRule   ^([^.]+)\.domain\.com(.*) https://www.domain.com/something?subdomain=$1 [P,L]


Whenever I call https://abc.domain.com - the response I am getting is the homepage but no matter what I am appending to the end of the subdomain, I will get the same response. It's like the rewrite isn't responding well.

Any help would be appreciated, or if you could share how you'd setup reverse proxy, rewrite, wildcard subdomain and SSL all together


Trending Tags