登录 | 注册 | FAQ
Anonymous

How to create dynamic subdomains in htaccess php?

+ 发表回复

4 篇帖子 分页: 1 / 1


How to create dynamic subdomains in htaccess php?

mahajan_php » 周三 5月 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
头像

mahajan_php

  • 帖子: 13
  • 注册: 周一 2月 20, 2012 1:09 pm

Re: How to create dynamic subdomains in htaccess php?

XainPro » 周三 5月 02, 2012 7:29 am

in your HTACCESS FILE WRITE

代码: 全选
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
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm

Re: How to create dynamic subdomains in htaccess php?

srinivastamada » 周四 3月 24, 2016 4:46 pm

Create Dynamic Subdomains using PHP and Htaccess

http://www.9lessons.info/2016/03/how-to ... ccess.html
头像

srinivastamada

  • 帖子: 1
  • 注册: 周四 3月 24, 2016 4:45 pm

Re: How to create dynamic subdomains in htaccess php?

saeednri2 » 周六 9月 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.
---------------------------
طراحی سایت
头像

saeednri2

  • 帖子: 4
  • 注册: 周六 9月 03, 2016 9:19 am


+ 发表回复

分页: 1 / 1