简体   繁体   中英

How to rewrite the my URL like sub domain by using .htaccess

Hi this my website http://techiesbadi.tk/

here rewrite the url like this test.techiesbadi.tk as http://techiesbadi.tk/index.php?siteName=test

i used this .htaccess code

Options +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteRule ^([aA-zZ])$ index.php?siteName=$1
RewriteCond %{HTTP_HOST} ^(^.*)\.techiesbadi.tk
RewriteRule (.*) index.php?siteName=%1

But my problem is when i redirect test.techiesbadi.tk it gives the This webpage is not available DNS_PROBE_FINISHED_NXDOMAIN

Is there any mistake in my code please help me.

You can see my website http://techiesbadi.tk/ here i implemented some mechanism like sub domain creation.

Thanks in advance.

I don't see a good reason to do this, but it's possible with wildcard DNS.

Currently in your DNS setup you'd have something like:

techiesbadi.tk. 14273 IN A 31.220.16.205

If you add this:

*.techiesbadi.tk. 14273 IN A 31.220.16.205

Hence, all requests to a subdomain of your site will still route. You can parse the subdomain within Apache's rules, PHP, whatever.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM