Reputation: 133
I am currently using a custom MVC Architecture to create my website.
The problem is that when I enter localhost/website/ which in the future would be www.website.com/, I want my homepage to be shown. Currently I am making this work by using localhost/website/home/ but I don't want that, I just want localhost/website/ which automatically shows the homepage.
I have tried to do this with htaccess, but without any success. When I navigate to localhost/website/ it shows me an error 'This webpage is not available'.
My htaccess code: This is found inside my public folder.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
I hope that made some sense and that someone could help me.
Thanks
Upvotes: 4
Views: 139
Reputation: 786021
You can have a new rule like this:
<IfModule mod_rewrite.c>
RewriteEngine On
# handle home page
RewriteRule ^/?$ home [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
Upvotes: 2
Reputation: 143946
Try adding, right after the line: RewriteEngine On
this rule:
RewriteRule ^$ index.php?url=home [L]
Upvotes: 0