Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:03:58+00:00 2026-06-14T22:03:58+00:00

The problem Initial problem: Hi I have a newly made Yii site where I

  • 0

The problem

Initial problem:
Hi I have a newly made Yii site where I want to remove the index.php from the URL.
Example: “/index.php/site/index” should be “/site/index”

I have been using this http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x guide but i only receive 404.

I hope that you are able to point a mistake or help me debug this problem!
Please let me know if I have left out any relevant information.

OBS: The “home” page works as intended, other pages are broken.

Status of the problem:
It seems like it is an apache/ubuntu problem with mod_rewrite.so

Answer

After help from different people it all works now 😀 I had to install “rewrit” to get it running, i did that by writing
Running a2enmod rewrit
The below configuration of my system solved the problem for me, I hope this thread will help others in similar problems.

My system

Server version: Apache/2.2.22 (Ubuntu)  
Server built:   Nov  8 2012 21:37:45

Apache httpd.conf

<Directory "/var/www/MY_SITE/FOLDER_CONTAINING_YII/">
AllowOverride All
#...
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so

This is the entire content of the file

Apache Error Log

File does not exist: /.../htdocs/site, referer: http://.../htdocs/index.php/site/index  

I added the dots

Restart Apache

kah@webaalborg:/etc/apache2/sites-available$ sudo service apache2 restart
 * Restarting web server apache2 
[Mon Nov 26 20:16:35 2012] [warn] module rewrite_module is already loaded, skipping
  ... waiting 
[Mon Nov 26 20:16:36 2012] [warn] module rewrite_module is already loaded, skipping
                                                                          [ OK ]

/ect/apache2/available-sites/default

...
DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
    <Directory /var/www/MY_SITE>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
     </Directory>
...

Yii Directory structure:

  • framework
  • htdocs
    • assets
    • css
    • .htaccess
    • index.php
    • index-test.php
    • themes
  • protected

.htaccess

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

main.php config file

'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        'caseSensitive'=>false,
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',   
        ),
    ),  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:03:59+00:00Added an answer on June 14, 2026 at 10:03 pm

    If you are working on Linux(say ubuntu) then go to the path /etc/apache2/sites-available/ there you will find a file named as default,

        <Directory /var/www/> <--- ***root directory***
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all <---- ***change this line***
        Order allow,deny
        allow from all
        </Directory>
    

    and i think your problem will resolve.

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll first describe my initial problem - I have a few site global variables
Salutations everyone, I have a somewhat strange problem with my repo. Initial I only
[Update]: my initial example doesn't reflect my problem. Updated the sample, hopfully it is
I have the same initial problem as described in Integrate NSStepper with NSTextField: I
Initial Problem protected function _initMail() { $this->bootstrap('mail'); } in my Bootstrap.php Fails with a:
I have a problem in giving initial value zero to a signal type of
I'll like to combine both my initial problem which leads me to this one
Additional questions regarding SilentGhost's initial answer to a problem I'm having parsing Twitter RSS
Problem: I have a table that prints out vertical but I would like it
I want to store all my sessions in a DB and have read up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.