Hi,
I've read and done URL Rewriting using the URL Management as stated in:
http://www.yiiframew...uide/topics.url
Sadly, I can't make it work in Linux (Xubuntu 9.04), it always shows Page Not Found Error. But it works well in Windows. Are there any particular settings that I must configure at apache2.conf before I can start using .htaccess ? Any help would be greatly appreciated.
Note:
For Linux and Windows, I am using LAMP Server.
Thank you!
Page 1 of 1
[SOLVED]How to hide index.php in Linux ?
#2
Posted 31 May 2009 - 09:07 PM
I could also not get the url rewrite to work using urlManager.
This is how my .htaccess looks like, it does not hide but I do not put index.php=r in my url:
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?r=$1
This is how my .htaccess looks like, it does not hide but I do not put index.php=r in my url:
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?r=$1
#3
Posted 31 May 2009 - 10:26 PM
Quote
I could also not get the url rewrite to work using urlManager.
This is how my .htaccess looks like, it does not hide but I do not put index.php=r in my url:
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?r=$1
This is how my .htaccess looks like, it does not hide but I do not put index.php=r in my url:
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?r=$1
What's your OS ? Linux, Mac, or Windows ?
I used the given .htaccess at the tutorial, and it works fine in Windows LAMP Server (default installation with no additional settings). But in Xubuntu 9.04 or in Linux, it does not work, so I guess there must be some setting to be set first in the apache configuration file in order to read .htaccess. But I am not sure...
I hope someone can answer this soon.
Thanks.
#4
Posted 31 May 2009 - 10:56 PM
It is working for me in Windows and Linux (with hostmontser).
By the check this cookbook
http://www.yiiframew...oc/cookbook/15/
By the check this cookbook
http://www.yiiframew...oc/cookbook/15/
#5
Posted 31 May 2009 - 11:21 PM
mod_rewrite might not be running with apache. When you say you are running Lamp I assume you are running this form your home server and therefore have control over it.
If using a Debian/*buntu server you can enable this module by running
Then restart Apache and try again.
If using a Debian/*buntu server you can enable this module by running
Then restart Apache and try again.
#6
Posted 01 June 2009 - 12:46 AM
Quote
It is working for me in Windows and Linux (with hostmontser).
By the check this cookbook
http://www.yiiframew...oc/cookbook/15/
By the check this cookbook
http://www.yiiframew...oc/cookbook/15/
@foe: Is that if I install PHP as CGI ?
Quote
mod_rewrite might not be running with apache. When you say you are running Lamp I assume you are running this form your home server and therefore have control over it.
If using a Debian/*buntu server you can enable this module by running
Then restart Apache and try again.
If using a Debian/*buntu server you can enable this module by running
Then restart Apache and try again.
@dubby: Thanks, I have done what you have told me, but still I got Page Not Found error. Any other ideas ? Because I am new in Linux, and right now, I am feel kinda stuck.
#7
Posted 01 June 2009 - 03:45 AM
@revo110:
Did you install in the web root folder of your Vhost? If not, try to set RewriteBase. E.g. if your app is reached with http://example.com/myapp/index.php:
Did you install in the web root folder of your Vhost? If not, try to set RewriteBase. E.g. if your app is reached with http://example.com/myapp/index.php:
#8
Posted 01 June 2009 - 04:36 AM
Quote
@revo110:
Did you install in the web root folder of your Vhost? If not, try to set RewriteBase. E.g. if your app is reached with http://example.com/myapp/index.php:
Did you install in the web root folder of your Vhost? If not, try to set RewriteBase. E.g. if your app is reached with http://example.com/myapp/index.php:
@Mike: Thank you! What's a VHost by the way ?
But I have found another way to make the url rewrite works in Linux, I do not know if this is the correct one to do it but it works for me:
Open your terminal and follow these steps:
Step 1: Enable the mod_rewrite module
sudo a2enmod rewrite
Step 2: Give permission to you are as root to modify the default file
sudo chown admin:admin /etc/apache2/sites-available/default
Step 3:
Go to the etc/apache2/sites-available/default, and open the default with Text Editor.
Step 4:
Find these lines of code
Step 5: Restart your apache
sudo /etc/init.d/apache2 restart
It should now work!
Share this topic:
Page 1 of 1

Help
This topic is locked












