Zaloguj | Zarejestruj | FAQ
Anonymous

How to create dynamic subdomains in htaccess php?

+ Odpowiedz

Posty: 4 Strona 1 z 1


How to create dynamic subdomains in htaccess php?

przez mahajan_php » Śr maja 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
Avatar użytkownika

mahajan_php

  • Posty: 13
  • Dołączył(a): Pn lut 20, 2012 1:09 pm

Re: How to create dynamic subdomains in htaccess php?

przez XainPro » Śr maja 02, 2012 7:29 am

in your HTACCESS FILE WRITE

Kod: Zaznacz cały
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
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm

Re: How to create dynamic subdomains in htaccess php?

przez srinivastamada » Cz mar 24, 2016 4:46 pm

Create Dynamic Subdomains using PHP and Htaccess

http://www.9lessons.info/2016/03/how-to ... ccess.html
Avatar użytkownika

srinivastamada

  • Posty: 1
  • Dołączył(a): Cz mar 24, 2016 4:45 pm

Re: How to create dynamic subdomains in htaccess php?

przez saeednri2 » So wrz 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.
---------------------------
طراحی سایت
Avatar użytkownika

saeednri2

  • Posty: 4
  • Dołączył(a): So wrz 03, 2016 9:19 am


+ Odpowiedz

Strona 1 z 1