Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php URL参数重写或重定向为子域_Php_Apache_.htaccess_Codeigniter_Redirect - Fatal编程技术网

Php URL参数重写或重定向为子域

Php URL参数重写或重定向为子域,php,apache,.htaccess,codeigniter,redirect,Php,Apache,.htaccess,Codeigniter,Redirect,我创建了一个通配符域 我的产品页面URL是: http://www.example.com/add/productdetails/city/product_title/Product_ID 我想将上述URL改写为: http://www.city.example.com/add/productdetails/product_title/Product_ID 以城市名称作为子域 请帮助我在codeigniter中配置重写规则网站将此代码添加到.htaccess文件中 RewriteCond %

我创建了一个通配符域

我的产品页面URL是:

http://www.example.com/add/productdetails/city/product_title/Product_ID
我想将上述URL改写为:

http://www.city.example.com/add/productdetails/product_title/Product_ID
以城市名称作为子域


请帮助我在codeigniter中配置重写规则网站

将此代码添加到.htaccess文件中

RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^/?$ "http\:\/\/city\.example\.com\/" [R=301,L]

城市是一个动态的参数,它会随着产品列表的变化而变化。你尝试了什么?