Nish
Nish

Reputation: 1137

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

Upvotes: 3

Views: 262

Answers (1)

anubhava
anubhava

Reputation: 785276

Change your rule to this:

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

Upvotes: 2

Related Questions