简体   繁体   English

需要有关Codeigniter框架.htaccess规则的帮助

[英]Need help on Codeigniter framework .htaccess rule

I am working on a script which is developed by another developer. 我正在研究另一个开发人员开发的脚本。 He did't used base_path() in url's, when i configured script on my local machine(xampp) i am redirecting outside of the project directory. 当我在本地计算机(xampp)上配置脚本时,他没有在URL中使用base_path(),而是将其重定向到项目目录之外。

Project directory /testing/

<link rel="stylesheet" href="/css/quick_register.css" />
<a href="/account/">Account</account>


online it works perfectly but when i click on this link local system it redirects me      

http://localhost/xampp

it should redirect me on http://localhost/testing/account

here is online .htaccess rule


#URL Re-writing
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1

Thanks 谢谢

As your project is under "testing" folder you need to update the rewritebase according to your project location. 由于您的项目位于“测试”文件夹下,因此您需要根据项目位置更新rewritebase。 Try something like below with your htaccess file: 使用htaccess文件尝试以下操作:

#URL Re-writing
RewriteEngine On
RewriteBase /testing

Try with/without trailing slashes, it should work. 尝试使用/不使用斜杠,它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM