0

Please forgive my lack of knowledge, this is more of a learning project than anything else.

I have a linux box, and it works pretty much fine. When i go to example.com/css it says theres one file in there, bootstrap.min.css When i go to example.com/css/bootstrap.min.css, it gives me a 404 error.

I have only one htaccess file to remove the index.php from the url, which also i renamed to htaccess (Instead of .htaccess, so apache wont find it) and i restarted the server, yet no help. I also tried to chmod the css file 755 but no help.

Contents of the htaccess file:

RewriteEngine On
 RewriteBase /

 # Allow any files or directories that exist to be displayed directly
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Please help, i am very confused about this. I tried to google excessively but i came up with nothing.

Edit: I found the solution to be renamed the htaccess file to something entirely different and restarting. Is there any way i can still implement the losing of the .php?

1 Answer 1

0

I would recommend replacing the .htaccess file you provided with this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]

This answer was provided at https://stackoverflow.com/questions/4908122/removing-the-php-extension-with-mod-rewrite

Mod_rewrite is extremely powerful, but it's also often difficult to understand exactly what it's doing.

If the new .htaccess file contents still don't do what you want, I've found it's often helpful to turn on rewrite logging to see exactly what's going on: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging

A handy command for following the output of a log file in real time is tail -f <path-to-log-file>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .