I have got a very specific problem. I am using wamp server to run my codeigniter projects locally. I have loaded mod_rewrite in and it is showing in my phpinfo.
In my wamp root directory, I have a codeigniter project folder "mysite".Here is the directory structure of mysite.
-mysite
|--images
|--eshots
|--useruploads
|--temp
|--SpryAssets
|--css
|--js
|--timthumb
After enabling this mod_rewrite, I modified my "host" file in my windows directory and added this line of code in my virtual host file to access my website like this. (mysite.local)
127.0.0.1 mysite.local
After this I created an htaccess file in root directory (ie under mysite folder)
htaccess file:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|lists|eshots|useruploads|temp|SpryAssets|css|js|robots\.txt|timthumb\.php)
RewriteRule ^(.*)$ /index.php?$1 [L]
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
After this, when I try to access my website from the wamp, it leads me to nowhere. For example, if I click from localhost's project folder ie mysite, it takes me back to the localhost folder and my URL looks like this:
and when I click on mysite again, it shows the URL like this:
http://mysite.local/mysite/mysite
And after this, my link doesn't take me to the web pages. And remain stuck here. Why am I getting this behavior from server? Is there any problem with CODEIGNITER or htaccess file that is stopping this? And what steps I need to do so that I could get each N everything working including javascript, css, images .
How to deal with this challenging problem?
Mostly people say you need to have your mod_rewrite enabled or read manual provided from Apache.
[UPDATED]: when I TRIED WID new codeigniter project.FIRST,I copied all the files apart from htaccess file into project folder.Luckily i was able to navigate to the index page but it didnt show me any css,image,scripts. My htaccess consists of only these bits: RewriteEngine on .
What shall i do now to make my js,images work as above?Apache_error log looks like this:.Also,when i try to move onto next pages ,it says "(Error:404)The requested URL /Code/wham.local/categories/listings/Products was not found".Kindly suggest.Where wham.local is virtual host.
apache_error Log:
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/css, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/css, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/js, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/js, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/js, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/js, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/js, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images, referer: http://localhost/Code/
[Sun Nov 25 13:00:54 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images
[Sun Nov 25 13:01:03 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images
[Sun Nov 25 13:01:55 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/images
[Sun Nov 25 13:01:56 2012] [error] [client 127.0.0.1] File does not exist: D:/wamp/www/Code/wham.local, referer: http://localhost/Code/
check the http.conf file in C:\\wamp\\bin\\apache\\Apache2.2.17\\conf if their is entry like this #Virtual hosts #Include conf/extra/httpd-vhosts.conf then open the file httpd-vhosts.conf add below lines in it.
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/mysite/"
ServerName mysite.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/"
ServerName localhost
</VirtualHost>
otherwise you can add this line to httpd.conf file also and restart ur server. this is the virtual host concept.
It looks like this line is messing with you:
RewriteCond $1 !^(index\.php|images|lists|eshots|useruploads|temp|SpryAssets|css|js|robots\.txt|timthumb\.php)
Try this instead
RewriteCond %{REQUEST_URI} !^(index\.php|images|lists|eshots|useruploads|temp|SpryAssets|css|js|robots\.txt|timthumb\.php)
你需要为apache启用重写模块..你可以通过转到wamp tray icon
> apache
> apache module
然后选择rewrite module
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.