I just started learning how to write htaccess . I got the following code from this page, which redirects everything to an index.php file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/ [L]
</IfModule>
I understood all lines except ^$ public/ [L] and (.*) public/ [L].What does they mean.To me it looks like some regular epression :)..
I know RewriteRule is used for writing rules for redirecting .But what do symbols $ ,(,),., * etc. indicate ?.
When I put these lines to .htaccess I got the following error
But when I comment the 4th line,it is working..ie .the following code is working
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
#RewriteRule (.*) public/ [L]
</IfModule
So what is the problem here?
i think you are inside rewrite loop like blew:
you rewrite abc.com/anything to abc.com/public and also you are rewriting /public to /public.
maybe you should specify which url must be rewrite . (limit your requests) like this :
RewriteEngine on
RewriteRule ^$ public/ [NC,L]
RewriteRule ^index.php(.*)$ public/$1 [NC,L]
rewrites index.php?requests to public/?requests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With