Jazi
Jazi

Reputation: 6752

.htaccess and mod-rewrite

This is my code in .htaccess:

RewriteEngine On

RewriteRule ^(.*)$ framework/public_html/index.php/$1 [PT,L]

I'm getting "Internal Server Error". What's wrong?

Upvotes: 3

Views: 95

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49895

Try this:

RewriteCond %{REQUEST_URI} !^/framework/public_html/
RewriteRule ^(.*)$ framework/public_html/index.php/$1/ [PT,L,NC,QSA]

http://www.domain.com/sub/folder/me => [REQUEST_URI] => /sub/folder/me

First, when you want to redirect (.*) it also try to redirect to itself that is why you have a 500 error. so by saying: if it's not (!^) /framework/public_html/ then redirect to this URL.

QSA: Query string append means if you have ?var=1 it will use it and append to the redirected string.

NC: Non Case means capital letters and lower case letters are the same.

Upvotes: 4

Related Questions