Problem with .htaccess

Hello friends

I have problem with creating the .htaccess file, I created the file:




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


#otherwise forward it ti index.php

RewriteRule . index.php



I saved it in trackstar folder, but when I call the page:

http://localhost/trackstar/commentfeed.xml

I have the 404 error "Page not found"

Why? I saved the .htaccess on right place? Or I forgot something?

My system operation is ubuntu 10.10, I’m using Yii 1.1.4

I am not sure about your Apache configuration (are you using Apache Web Server?)

Here are some troubleshooting tips I took from the Apache documentation:

[extract]When you put configuration directives in a .htaccess

file, and you don't get the desired effect, there are a number of


things that may be going wrong.











Most commonly, the problem is that [url="http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride"]AllowOverride[/url] is not


set such that your configuration directives are being honored. Make


sure that you don't have a AllowOverride None in effect


for the file scope in question. A good test for this is to put garbage


in your .htaccess file and reload. If a server error is


not generated, then you almost certainly have AllowOverride


None in effect.











If, on the other hand, you are getting server errors when trying to


access documents, check your Apache error log. It will likely tell you


that the directive used in your .htaccess file is not


permitted. Alternately, it may tell you that you had a syntax error,


which you will then need to fix.

[/extract]

Check this post for information on how to enable AllowOverride - http://www.yiiframework.com/forum/index.php?/topic/4968-

On some servers the last line need to be changed to


RewriteRule ^.*$ /index.php

Hello friends

I believe that my problem is apache configuration how you are said, I´ll go trying change the configuration.

When I finish I add here the answer.

Thanks for help

Some apache servers require the following setting as it is written:




Options +FollowSymLinks

IndexIgnore */*


<IfModule mod_rewrite.c>

RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule ^.*$ /index.php [L] 

</IfModule>



Hello friends

I tried many things but do not fix the error

My operation system is ubuntu 10.10, and I’m using apache 2.

I found on the internet and on ubuntu the file httpd.conf is blank, the configurations staying on apache2.conf, but in this file there is this line: Include httpd.conf, that call the httpd.conf and run, so I put in the httpd.conf this:




LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

<Directory />

	Options FollowSymLinks

	AllowOverride All

	Order allow,deny

	Allow from All

</Directory>



It is the apache2.conf




#

# Based upon the NCSA server configuration files originally by Rob McCool.

#

# This is the main Apache server configuration file.  It contains the

# configuration directives that give the server its instructions.

# See http://httpd.apache.org/docs/2.2/ for detailed information about

# the directives.

#

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.  

#

# The configuration directives are grouped into three basic sections:

#  1. Directives that control the operation of the Apache server process as a

#     whole (the 'global environment').

#  2. Directives that define the parameters of the 'main' or 'default' server,

#     which responds to requests that aren't handled by a virtual host.

#     These directives also provide default values for the settings

#     of all virtual hosts.

#  3. Settings for virtual hosts, which allow Web requests to be sent to

#     different IP addresses or hostnames and have them handled by the

#     same Apache server process.

#

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "foo.log"

# with ServerRoot set to "/etc/apache2" will be interpreted by the

# server as "/etc/apache2/foo.log".

#


### Section 1: Global Environment

#

# The directives in this section affect the overall operation of Apache,

# such as the number of concurrent requests it can handle or where it

# can find its configuration files.

#


#

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#

# NOTE!  If you intend to place this on an NFS (or otherwise network)

# mounted filesystem then please read the LockFile documentation (available

# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);

# you will save yourself a lot of trouble.

#

# Do NOT add a slash at the end of the directory path.

#

#ServerRoot "/etc/apache2"


#

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.

#

LockFile ${APACHE_LOCK_DIR}/accept.lock


#

# PidFile: The file in which the server should record its process

# identification number when it starts.

# This needs to be set in /etc/apache2/envvars

#

PidFile ${APACHE_PID_FILE}


#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300


#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On


#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100


#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15


##

## Server-Pool Size Regulation (MPM specific)

## 


# prefork MPM

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_prefork_module>

    StartServers          5

    MinSpareServers       5

    MaxSpareServers      10

    MaxClients          150

    MaxRequestsPerChild   0

</IfModule>


# worker MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a

#              graceful restart. ThreadLimit can only be changed by stopping

#              and starting Apache.

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_worker_module>

    StartServers          2

    MinSpareThreads      25

    MaxSpareThreads      75 

    ThreadLimit          64

    ThreadsPerChild      25

    MaxClients          150

    MaxRequestsPerChild   0

</IfModule>


# event MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_event_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75 

    ThreadLimit          64

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>


# These need to be set in /etc/apache2/envvars

User ${APACHE_RUN_USER}

Group ${APACHE_RUN_GROUP}


#

# AccessFileName: The name of the file to look for in each directory

# for additional configuration directives.  See also the AllowOverride

# directive.

#


AccessFileName .htaccess


#

# The following lines prevent .htaccess and .htpasswd files from being 

# viewed by Web clients. 

#

<Files ~ "^\.ht">

    Order allow,deny

    #Deny from all

    Satisfy all


	

</Files>


#

# DefaultType is the default MIME type the server will use for a document

# if it cannot otherwise determine one, such as from filename extensions.

# If your server contains mostly text or HTML documents, "text/plain" is

# a good value.  If most of your content is binary, such as applications

# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are

# text.

#

DefaultType text/plain




#

# HostnameLookups: Log the names of clients or just their IP addresses

# e.g., www.apache.org (on) or 204.62.129.132 (off).

# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that

# each client request will result in AT LEAST one lookup request to the

# nameserver.

#

HostnameLookups Off


# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a <VirtualHost>

# container, error messages relating to that virtual host will be

# logged here.  If you *do* define an error logfile for a <VirtualHost>

# container, that host's errors will be logged there and not here.

#

ErrorLog ${APACHE_LOG_DIR}/error.log


#

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn


# Include module configuration:

Include mods-enabled/*.load

Include mods-enabled/*.conf


# Include all the user configurations:

Include httpd.conf


# Include ports listing

Include ports.conf


#

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i

#

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %O" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent


# Include of directories ignores editors' and dpkg's backup files,

# see README.Debian for details.


# Include generic snippets of statements

Include conf.d/


# Include the virtual host configurations:

Include sites-enabled/




It is my .htaccess:




Options +FollowSymLinks

IndexIgnore */*


RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule . index.php



but not solved and show de 404 erros, page not found

Somebody knows how to fix this?

It is may main.php:




<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'My Web Application',


	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

	),


        'modules'=>array(

		// uncomment the following to enable the Gii tool

		'gii'=>array(

			'class'=>'system.gii.GiiModule',

			'password'=>'123456',

		),

	),


	// application components

	'components'=>array(

               	'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

                //enable authentication for database

                

		// uncomment the following to enable URLs in path-format

		/*

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

		),

		*/

            /*

		'db'=>array(

			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

		),

		// uncomment the following to use a MySQL database

		*/

		'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=trackstar_dev',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '123456',

			'charset' => 'utf8',

		),

                'authManager'=>array(

                    'class' => 'CDbAuthManager',

                    'connectionID' => 'db',

                ),

               

                  'urlManager'=>array(

                        'urlFormat'=>'path',

                        'rules'=>array(

                        '<pid:\d+>/commentfeed'=>array('site/commentFeed','urlSufix'=>'.xml', 'caseSensitive'=>false),

                        'commentfeed'=>array('site/commentFeed','urlSuffix'=>'.xml','caseSensitive'=>false),

                       

                                ),

                        'showScriptName'=>false,

                ),  

		

		'errorHandler'=>array(

			// use 'site/error' action to display errors

            'errorAction'=>'site/error',

        ),

		'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

				array(

					'class'=>'CFileLogRoute',

					'levels'=>'error, warning',

				),

				// uncomment the following to show log messages on web pages

				/*

				array(

					'class'=>'CWebLogRoute',

				),

				*/

			),

		),

	),


	// application-level parameters that can be accessed

	// using Yii::app()->params['paramName']

	'params'=>array(

		// this is used in contact page

		'adminEmail'=>'webmaster@example.com',

	),

);



It is my comment controller:




<?php

Yii::import('application.vendors.*');

require_once('Zend/Feed.php');

require_once('Zend/Feed/Rss.php');


class CommentController extends Controller

{


        

	/**

	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning

	 * using two-column layout. See 'protected/views/layouts/column2.php'.

	 */

	public $layout='//layouts/column2';


	/**

	 * @return array action filters

	 */

	public function filters()

	{

		return array(

			'accessControl', // perform access control for CRUD operations

		);

	}


	/**

	 * Specifies the access control rules.

	 * This method is used by the 'accessControl' filter.

	 * @return array access control rules

	 */

	public function accessRules()

	{

		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions

				'actions'=>array('index','view','feed'),

				'users'=>array('*'),

			),

			array('allow', // allow authenticated user to perform 'create' and 'update' actions

				'actions'=>array('create','update'),

				'users'=>array('@'),

			),

			array('allow', // allow admin user to perform 'admin' and 'delete' actions

				'actions'=>array('admin','delete'),

				'users'=>array('admin'),

			),

			array('deny',  // deny all users

				'users'=>array('*'),

			),

		);

	}


	/**

	 * Displays a particular model.

	 * @param integer $id the ID of the model to be displayed

	 */

	public function actionView($id)

	{

		$this->render('view',array(

			'model'=>$this->loadModel($id),

		));

	}


	/**

	 * Creates a new model.

	 * If creation is successful, the browser will be redirected to the 'view' page.

	 */

	public function actionCreate()

	{

		$model=new Comment;


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['Comment']))

		{

			$model->attributes=$_POST['Comment'];

			if($model->save())

				$this->redirect(array('view','id'=>$model->id));

		}


		$this->render('create',array(

			'model'=>$model,

		));

	}


	/**

	 * Updates a particular model.

	 * If update is successful, the browser will be redirected to the 'view' page.

	 * @param integer $id the ID of the model to be updated

	 */

	public function actionUpdate($id)

	{

		$model=$this->loadModel($id);


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['Comment']))

		{

			$model->attributes=$_POST['Comment'];

			if($model->save())

				$this->redirect(array('view','id'=>$model->id));

		}


		$this->render('update',array(

			'model'=>$model,

		));

	}


	/**

	 * Deletes a particular model.

	 * If deletion is successful, the browser will be redirected to the 'index' page.

	 * @param integer $id the ID of the model to be deleted

	 */

	public function actionDelete($id)

	{

		if(Yii::app()->request->isPostRequest)

		{

			// we only allow deletion via POST request

			$this->loadModel($id)->delete();


			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser

			if(!isset($_GET['ajax']))

				$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));

		}

		else

			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');

	}


	/**

	 * Lists all models.

	 */

	public function actionIndex()

	{

		$dataProvider=new CActiveDataProvider('Comment');

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));

	}


	/**

	 * Manages all models.

	 */

	public function actionAdmin()

	{

		$model=new Comment('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Comment']))

			$model->attributes=$_GET['Comment'];


		$this->render('admin',array(

			'model'=>$model,

		));

	}


	/**

	 * Returns the data model based on the primary key given in the GET variable.

	 * If the data model is not found, an HTTP exception will be raised.

	 * @param integer the ID of the model to be loaded

	 */

	public function loadModel($id)

	{

		$model=Comment::model()->findByPk((int)$id);

		if($model===null)

			throw new CHttpException(404,'The requested page does not exist.');

		return $model;

	}


	/**

	 * Performs the AJAX validation.

	 * @param CModel the model to be validated

	 */

	protected function performAjaxValidation($model)

	{

		if(isset($_POST['ajax']) && $_POST['ajax']==='comment-form')

		{

			echo CActiveForm::validate($model);

			Yii::app()->end();

		}

	}

        public function actionFeed()

        {

            if(isset($_GET['pid'])) $projectId = intval($_GET['pid']);

            else $projectId = null;


            $comments = Comment::model()->findRecentComments(20, $projectId);


            //convert from an array of comment AR class instance to an name=>value array for zend

            $entries=array();


            foreach ($comments as $comment)

            {

                $entries[]=array(

                    'title'=>$comment->issue->name,

                    'link'=>CHtml::encode($this->createAbsoluteUrl('issue/view',array('id'=>$comment->issue->id))),

                    'description'=> $comment->author->username . 'says:<br />' . $comment->content,

                    'lastUpdate'=>  strtotime($comment->create_time),

                    'author'=>$comment->author->username,

                );

            }


            //now use the Zend Feed class to generate the Feed, generate and render RSS feed

            $feed=Zend_Feed::importArray(array(

                    'title'     => 'TrackStar Project Comments Feed',

                    'link'      => $this->createUrl(''),

                    'charset'   => 'UTF-8',

                    'entries'   => $entries,

                ), 'rss');


            $feed->send();


        }

}




Hello Friends

my problem was solved, my brother help me, He set up de apache2.conf. I did not know this form, I used the httpd.conf.

Thanks for help

glad to hear you solved thiss…

i have the same problem too…

now im gonna check apache2.conf

Below is my apache2.conf. I hope it helps you:




#

# Based upon the NCSA server configuration files originally by Rob McCool.

#

# This is the main Apache server configuration file.  It contains the

# configuration directives that give the server its instructions.

# See http://httpd.apache.org/docs/2.2/ for detailed information about

# the directives.

#

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.  

#

# The configuration directives are grouped into three basic sections:

#  1. Directives that control the operation of the Apache server process as a

#     whole (the 'global environment').

#  2. Directives that define the parameters of the 'main' or 'default' server,

#     which responds to requests that aren't handled by a virtual host.

#     These directives also provide default values for the settings

#     of all virtual hosts.

#  3. Settings for virtual hosts, which allow Web requests to be sent to

#     different IP addresses or hostnames and have them handled by the

#     same Apache server process.

#

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "foo.log"

# with ServerRoot set to "/etc/apache2" will be interpreted by the

# server as "/etc/apache2/foo.log".

#


### Section 1: Global Environment

#

# The directives in this section affect the overall operation of Apache,

# such as the number of concurrent requests it can handle or where it

# can find its configuration files.

#


#

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#

# NOTE!  If you intend to place this on an NFS (or otherwise network)

# mounted filesystem then please read the LockFile documentation (available

# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);

# you will save yourself a lot of trouble.

#

# Do NOT add a slash at the end of the directory path.

#

#ServerRoot "/etc/apache2"


#

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.

#

LockFile ${APACHE_LOCK_DIR}/accept.lock


#

# PidFile: The file in which the server should record its process

# identification number when it starts.

# This needs to be set in /etc/apache2/envvars

#

PidFile ${APACHE_PID_FILE}


#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300


#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On


#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100


#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15


##

## Server-Pool Size Regulation (MPM specific)

## 


# prefork MPM

# StartServers: number of server processes to start

# MinSpareServers: minimum number of server processes which are kept spare

# MaxSpareServers: maximum number of server processes which are kept spare

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_prefork_module>

    StartServers          5

    MinSpareServers       5

    MaxSpareServers      10

    MaxClients          150

    MaxRequestsPerChild   0

</IfModule>


# worker MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a

#              graceful restart. ThreadLimit can only be changed by stopping

#              and starting Apache.

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_worker_module>

    StartServers          2

    MinSpareThreads      25

    MaxSpareThreads      75 

    ThreadLimit          64

    ThreadsPerChild      25

    MaxClients          150

    MaxRequestsPerChild   0

</IfModule>


# event MPM

# StartServers: initial number of server processes to start

# MaxClients: maximum number of simultaneous client connections

# MinSpareThreads: minimum number of worker threads which are kept spare

# MaxSpareThreads: maximum number of worker threads which are kept spare

# ThreadsPerChild: constant number of worker threads in each server process

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule mpm_event_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75 

    ThreadLimit          64

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>


# These need to be set in /etc/apache2/envvars

User ${APACHE_RUN_USER}

Group ${APACHE_RUN_GROUP}


#

# AccessFileName: The name of the file to look for in each directory

# for additional configuration directives.  See also the AllowOverride

# directive.

#


AccessFileName .htaccess


#

# The following lines prevent .htaccess and .htpasswd files from being 

# viewed by Web clients. 

#

<Files ~ "^\.ht">

    Order allow,deny

    #Deny from all

    Satisfy all


	

</Files>


#

# DefaultType is the default MIME type the server will use for a document

# if it cannot otherwise determine one, such as from filename extensions.

# If your server contains mostly text or HTML documents, "text/plain" is

# a good value.  If most of your content is binary, such as applications

# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are

# text.

#

DefaultType text/plain




#

# HostnameLookups: Log the names of clients or just their IP addresses

# e.g., www.apache.org (on) or 204.62.129.132 (off).

# The default is off because it'd be overall better for the net if people

# had to knowingly turn this feature on, since enabling it means that

# each client request will result in AT LEAST one lookup request to the

# nameserver.

#

HostnameLookups Off


# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a <VirtualHost>

# container, error messages relating to that virtual host will be

# logged here.  If you *do* define an error logfile for a <VirtualHost>

# container, that host's errors will be logged there and not here.

#

ErrorLog ${APACHE_LOG_DIR}/error.log


#

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn


# Include module configuration:

Include mods-enabled/*.load

Include mods-enabled/*.conf


# Include all the user configurations:

Include httpd.conf


# Include ports listing

Include ports.conf


#

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i

#

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %O" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent


# Include of directories ignores editors' and dpkg's backup files,

# see README.Debian for details.


# Include generic snippets of statements

Include conf.d/


# Include the virtual host configurations:

Include sites-enabled/




I don’t think this:


<Files ~ "^\.ht">

    Order allow,deny

    #Deny from all

    Satisfy all

</Files>



is safe at all in the apache2.conf you posted Alexandre Carmo. I think you’re allowing random web users to view .htaccess and .htpasswd files in your web directory.

When I had this problem today, I found I needed to AllowOverride for the trackstar folder. This is done in the file that points Apache to your web folder in /etc/apache2./sites-available. I just added a new Directory block:




<Directory /home/username/webfolder/public_html/trackstar>

		Options Indexes FollowSymLinks MultiViews

		AllowOverride All

		Order allow,deny

		allow from all

</Directory>



After that I just needed to restart Apache. There was no need to alter apache2.conf or httpd.conf at all.

I also got the same problem, but nothing of the tips in this thread seem to work.

I added this lines to apache config file:




<Directory "C:/webtest/trackstar">

    Options None

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>

Alias /trackstar "C:/webtest/trackstar"


RewriteLog "logs/rewrite.log"

RewriteLogLevel 9



And when looking at the rewrite log, I see:




127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (3) [perdir C:/webtest/trackstar/] strip per-dir prefix: C:/webtest/trackstar/commentFeed -> commentFeed

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (3) [perdir C:/webtest/trackstar/] applying pattern '.' to uri 'commentFeed'

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (4) [perdir C:/webtest/trackstar/] RewriteCond: input='C:/webtest/trackstar/commentFeed' pattern='!-f' => matched

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (4) [perdir C:/webtest/trackstar/] RewriteCond: input='C:/webtest/trackstar/commentFeed' pattern='!-d' => matched

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (2) [perdir C:/webtest/trackstar/] rewrite 'commentFeed' -> 'index.php'

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (3) [perdir C:/webtest/trackstar/] add per-dir prefix: index.php -> C:/webtest/trackstar/index.php

127.0.0.1 - - [13/Sep/2011:08:21:18 +0200] [localhost/sid#626150][rid#5dfe0f0/initial] (1) [perdir C:/webtest/trackstar/] internal redirect with C:/webtest/trackstar/index.php [INTERNAL REDIRECT]



But still I get the 404 message (The requested URL /webtest/trackstar/index.php was not found on this server.).

I even modified index.php to:




<?php


echo '<pre>';var_dump($_SERVER); die;



for debugging purpose, but the index.php is never called.

Fixed it by chaning the .htaccess file to:




Options +FollowSymLinks

IndexIgnore */*


<IfModule mod_rewrite.c>

  RewriteEngine on


  #RewriteBase /


  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteCond %{REQUEST_FILENAME} !-d


  RewriteRule ^.*$ /trackstar/index.php

</IfModule>


ErrorDocument 500 "<h2>Application error</h2>Yii application failed to start properly"



Note the "/trackstar/" before index.php. This seem to cure the problem when running on a windowz machine.

Hi!

The solution ngc.7000 posted worked for me!

Thanks guys!

I’m using red hat linux and i just changed the “trackstar” for first folder after root site on my .htaccess file (located at my site root).

For newbies, it’s something like:

/var/www - root folder

My site is located at /var/www/nit/mysite (my site root)

So you have to set RewriteRule ^.*$ /nit/mysite/index.php

Thanks!