It is currently Sun Aug 20, 2017 3:03 am


Error when Hide index.php on server

Help with Web Design, Programming, and Graphics

Moderator: Gecko

Error when Hide index.php on server

Postby Whortiter » Wed Jun 24, 2015 7:14 am

Hi! I am using Yii and currently i am trying to hide the index.php from my URL. I have hosted my project on hostforlife server. The contents of my .htaccess file are

Code: Select all
<ifModule mod_rewrite.c>
Options -Multiviews
Options +FollowSymLinks
# Turn on the engine:
RewriteEngine on
# Don't perform redirects for files and directories that exist:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For everything else, redirect to index.php:
RewriteRule . index.php
</ifModule>


and in the config/main.php showScriptName=>False

I searched about it a lot and found that adding Options -Multiviews solves the problem. But it didnt work for me. It shows 404 - File or directory not found. So any help will be appreciated
Whortiter
Newbie
Newbie
 
Posts: 1
Joined: Wed Jun 24, 2015 7:00 am

Thanks given:0
Thanks received:0
Top

Re: Error when Hide index.php on server

Postby Gecko » Wed Jun 24, 2015 4:54 pm

Whortiter,

If you're trying to hide the index.php for your URL http://your-domain.com/index.php so it just shows http://your-domain.com and loads the index'php page then try this in your htaccess file.

Code: Select all
<ifModule mod_rewrite.c>
# Turn on the engine:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</ifModule>


As for the Options -Multiviews and Options +FollowSymLinks they would have to come after the rewrite engine is turned on, but I don't think you'll need them.
User avatar
Gecko
Super Moderator
Super Moderator
 
Posts: 5206
Joined: Thu Oct 25, 2001 1:00 am
Location: Florida, USA

Thanks given:1
Thanks received:23
Top


Return to Web Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron