1

I'm working on yii framework and trying to remove index.php from url (httpx://localhost:801/index.php/aImages) it should be like this httpx://localhost:801/aImages . So the code given below is in my .htaccess file. This code is working on my localhost but not my team members machine.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>
2

6 Answers 6

4

try :

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

and in your config file, use:

...
'urlFormat'=>'path',
'showScriptName'=>false,
...
Sign up to request clarification or add additional context in comments.

Comments

1
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

reference : http://www.yiiframework.com/doc/guide/1.1/en/topics.url

Comments

1

You need to create .htaccess file

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

You can check here for further reference.

1 Comment

Thanks nana.chorage you reply was really helpful actually the rewrite_module was not working and the link you provided really helped.
0

Try this rule

RewriteRule ^index\.php/$ $1 [R=301,L]

Comments

0

The last line should be

RewriteRule (.*) index.php/$1 [L]

Comments

0

Go to .htaccess file and add the following lines...

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.