.htaccess - htaccess rewrite all subdomain to index.php -
i know question has been asked lot don't know why not work me :-? htaccess:
options +followsymlinks indexignore */* # turn on rewriteengine rewriteengine on # rules rewriterule ^(.*)$ index.php
this code should rewrite link path including subdomain index.php doesn't.
name of domain should not come htaccess since unknown!!! call htaccess 127.0.0.1 , many websites supposed linked localhost:
/etc/hosts
127.0.0.1 localhost 127.0.1.1 mypc 127.0.0.1 google.com 127.0.0.1 example.com
here, browser browse google.com or example.com while subdomains such sub1.google.com or sub1.example.com cannot found.
index.php
<?php $uri = 'http'. ($_server['https'] ? 's' : null) .'://'. $_server['http_host'].$_server[request_uri]; print_r($uri); ?>
does 1 know how .htaccess code work subdomains too?
if understood question right asking why google.com
correctly loads index.php on localhost sub1.google.com
etc. subdomains not.
you cannot override subdomain dns using hosts
file. accomplish either need add subdomains hosts
file or set private dns server records google.com
, *.google.com
pointing 127.0.0.1.
Comments
Post a Comment