Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
如何在本地计算机中重写.htaccess?_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

如何在本地计算机中重写.htaccess?

如何在本地计算机中重写.htaccess?,.htaccess,codeigniter,mod-rewrite,.htaccess,Codeigniter,Mod Rewrite,我有这个项目,这是从一个远程服务器 然后我将所有内容FTP到本地计算机,即本地主机,然后当我键入URL时,例如,localhot/test它将重定向到生产站点 我希望在我输入localhost时,不要将其重定向到生产站点。我想这是在某处。htaccess,有人能帮我这个吗 这是我的.htaccess代码: # see if the module is active <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HT

我有这个项目,这是从一个远程服务器

然后我将所有内容FTP到本地计算机,即本地主机,然后当我键入URL时,例如,localhot/test它将重定向到生产站点

我希望在我输入localhost时,不要将其重定向到生产站点。我想这是在某处。htaccess,有人能帮我这个吗

这是我的.htaccess代码:

 # see if the module is active
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

</IfModule> 
RewriteCond %{HTTP_HOST} ^\*\.test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.\*\.test\.com$
RewriteRule ^/?$ "http\:\/\/test\.com" [R=301,L]

RewriteCond %{HTTP_HOST} ^jobs\.test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.jobs\.test\.com$
RewriteRule ^/?$ "http\:\/\/test\.com" [R=301,L]
#查看模块是否处于活动状态
重新启动发动机
重写cond%{HTTPS}=在…上
重写cond%{HTTP_HOST}^www\.(.+)$[NC]
重写规则^(.*)$http://%1/$1[R=301,L]
1美元^(索引\.php | resources | robots\.txt)
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
RewriteCond%{HTTP\u HOST}^\*\.test\.com$[或]
重写cond%{HTTP\u HOST}^www\.\*\.test\.com$
重写规则^/?$“http\:\/\/test\.com”[R=301,L]
RewriteCond%{HTTP_HOST}^jobs\.test\.com$[或]
重写cond%{HTTP_HOST}^www\.jobs\.test\.com$
重写规则^/?$“http\:\/\/test\.com”[R=301,L]
无论如何,该项目是在CodeIgniter框架中编写的


非常感谢您的帮助。

尝试此
。htaccess
是的,我在CI中尝试了htaccess,但上面的代码修改得很好。不知道如何更改并使它在我的本地机器上工作告诉我你的操作系统和版本是什么我使用windows和xampp来本地机器确保你在xampp中有allowd rewrite url