Login | Register | FAQ
Anonymous

How to create dynamic subdomains in htaccess php?

+ Post a reply

4 posts Page 1 of 1


How to create dynamic subdomains in htaccess php?

by mahajan_php » Wed May 02, 2012 5:52 am

hi,

I wanna to create dynamic subdomains using htaccess. How can i create subdomains like my website

www.example.com/Html/home.php?type=jobs

to

jobs.example.com


Thanks
Ramson
User avatar

mahajan_php

  • Posts: 13
  • Joined: Mon Feb 20, 2012 1:09 pm

Re: How to create dynamic subdomains in htaccess php?

by XainPro » Wed May 02, 2012 7:29 am

in your HTACCESS FILE WRITE

Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com/Html/home.php?type=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([a-z0-9-]+)/? http://$1.example.com [R=301,NC,L]


Replace both instances of "example.com" with your domain name.
it will do
301 Redirect
http://www.example.com/Html/home.php?type=jobs
to
jobs.example.com
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: How to create dynamic subdomains in htaccess php?

by srinivastamada » Thu Mar 24, 2016 4:46 pm

Create Dynamic Subdomains using PHP and Htaccess

http://www.9lessons.info/2016/03/how-to ... ccess.html
User avatar

srinivastamada

  • Posts: 1
  • Joined: Thu Mar 24, 2016 4:45 pm

Re: How to create dynamic subdomains in htaccess php?

by saeednri2 » Sat Sep 03, 2016 11:51 am

Step 1
Go to your domain DNS(Domain Name Settings), click add zone record.
Step 2
You need to create a custom A record to serve all your subdomains. Select A record, HOST * POINTS TO: Your ID Address(Eg: 106.21.252.71)
Step 3
Repeat the same for HOST @, here is the listed A records
Step 4
Now add CNAME record, HOST www POINTS TO @ this refers to your IP address.

Create Dynamic Subdomains CNAME ZONE settings add

Step 5
CNAME list should be in following way.

Create Dynamic Subdomains CNAME record settings

Step 6
Save all of your domain DNS settings.
---------------------------
طراحی سایت
User avatar

saeednri2

  • Posts: 4
  • Joined: Sat Sep 03, 2016 9:19 am


+ Post a reply

Page 1 of 1