Val
Val

Reputation: 17522

.htaccess rewrite

can someone help me with the code to use only one file.

e.g.

domain.com/
domain.com/hello/world/
domain.com/help.php

all the above should load

domain.com/index.php

I have done this at home, but i cnt remember it and i dont have access to that code.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

i think the following is something that i remember but it aint working.

Upvotes: 0

Views: 380

Answers (1)

nerkn
nerkn

Reputation: 1982

check if rewrite module is working

cat  /etc/apache2/mods-available/rewrite.load 
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

this one is from zend framework, I think should be better than general used one

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Upvotes: 2

Related Questions