相关疑难解决方法(0)

.htaccess将非WWW重定向到WWW保留URI字符串

我正在运行CodeIgniter平台,该平台使用.htaccess接受类似的URL

http://www.mysite.com/controller/function/argument
Run Code Online (Sandbox Code Playgroud)

我目前使用一些.htaccess重写,即(简化):

RewriteEngine On
RewriteCond %{REQUEST_URI} !^(/index\.php|/images|/assets)
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

我想添加一个重写规则,将所有非www请求重定向到www.我还希望域名后面的URI字符串在重定向中保持不变.例如,如果用户发出请求http://mysite.com/controller/function/argument,我希望.htaccess文件在浏览器中重写请求http://www.mysite.com/controller/function/argument,然后处理请求.

php apache .htaccess mod-rewrite codeigniter

9
推荐指数
2
解决办法
9046
查看次数

标签 统计

.htaccess ×1

apache ×1

codeigniter ×1

mod-rewrite ×1

php ×1