Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess file doesn't work for home page

Following .htaccess doesn't work for root level page.

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^demo\-blog/(.*)$ demo\-blog/index.php/$1 [L]

If I access http://example.com/demo-blog/blog/publish.html then it works by executing file on http://example.com/demo-blog/index.php/blog/publish.html but when I access http://example.com/demo-blog/ it doesn't load the page from http://example.com/demo-blog/index.php. The .htaccess file is on the domain root. http://example.com/

Please let me know why it doesn't rewrite the url for the home page.

like image 795
Nish Avatar asked Dec 14 '25 16:12

Nish


1 Answers

Change your rule to this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^demo-blog(/.*|)$ demo-blog/index.php/$1 [L,NC]
like image 200
anubhava Avatar answered Dec 17 '25 07:12

anubhava



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!