Welcome Guest, Not a member yet? Register   Sign In
htaccess and paths?
#1

[eluser]Sverre Palmstrøm[/eluser]
Hi guys and gals.

I recenetly installed CI on my server, but there's always something coming up when you're new right? So here it goes!

As I want my URLs to be /whatever/ instead of /index.php/whatever/ I read that modifying the .htaccess file to
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
would solve that problem. Well, it did. However, my issue with this is that the paths seems to be broken. F.ex I can't display a image that's on the root of the subdomain I've installed CL on, and I can't link my css file I'm going to use in the test, due to that CI is giving me a 404 whenever I try to open those files. Yes, the URL are correct so it's something to do with the rewrite rules. As I'm no expert and very little knowledge of mod_rewrite I can't figure out how to fix this. So I'm asking you guys if there's a solution and if you will be so kind and tell me, cuz I'm getting a bit tired of wasting time trying to find something I don't seem to find.

Thank you.

Best regards.
Sverre Palmstrøm
#2

[eluser]Avatar[/eluser]
this is my .htaccess:
Code:
Options -indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /demo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
#3

[eluser]Avatar[/eluser]
I see a blank page both ways with index.php and without
#4

[eluser]Sverre Palmstrøm[/eluser]
Something like
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?$1 [L]
?
#5

[eluser]Sverre Palmstrøm[/eluser]
[quote author="yingyes" date="1204857768"]this is my .htaccess:
Code:
Options -indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /demo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
[/quote]

Woo! That worked! Thanks a lot! Big Grin
#6

[eluser]Avatar[/eluser]
no problem
#7

[eluser]rzrmon[/eluser]
[quote author="Sverre Palmstrøm" date="1204858999"][quote author="yingyes" date="1204857768"]this is my .htaccess:
Code:
Options -indexes
DirectoryIndex index.php
RewriteEngine On
RewriteBase /demo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
[/quote]

Woo! That worked! Thanks a lot! Big Grin[/quote]

Hello yingyes,

I treid it and it did not work. Should I change demo to the project name?

Thanks.
#8

[eluser]Sverre Palmstrøm[/eluser]
Change the RewriteBase to whetever directory that is your base.
If you have it on root, then change it to RewriteBasde /
#9

[eluser]rzrmon[/eluser]
Thanks a lot. It worked.




Theme © iAndrew 2016 - Forum software by © MyBB