Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.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?

like image 298
Jazi Avatar asked Apr 06 '26 02:04

Jazi


1 Answers

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.

like image 152
Book Of Zeus Avatar answered Apr 08 '26 22:04

Book Of Zeus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!