Hi, I’m new to Yii and Iam facing a major headache to setup the rewriting procedure.
I did an intensive search to the problem that Iam facing and I did all the configurations needed to activate the rewrite but without any luck, so I choose to write it hopefully someone will help me.
The problem is that all the links I request only the index view page is displayed.
ex: (not working)
xxxx://localhost/MyApplication/site/contact
xxxx://localhost/MyApplication/site/login
etc…
But when I insert the index.php before the controllerID then the proper view is displayed
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 to index.php
RewriteRule . index.php
When trying to visit a URL without /index.php/, insert a var_dump($_SERVER);exit; in your site controller’s index action, then view source, and copy/paste the array output here please.
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
</Directory>
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
The best approach is to typically replace any spaces with hyphens or underscores, regardless of if it’s for the web or not, because you never know when a file may be shared/uploaded somewhere and cause issues because of a space