Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Networking & Wireless
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Networking & Wireless
Having problems getting connected to the internet or getting your wireless card to work? Ask here.

 
Thread Tools Display Modes
Old September 11th, 2006   #1
zoon_unit
5 Cups of Ubuntu
 
Join Date: Jun 2006
Beans: 37
How to enable mod_rewrite in Ubuntu server??

I'm trying to find the right way/file to enable mod_rewrite. I know the typical place to do this is in httpd.conf, but of course Ubuntu has its own funky way of doing this with the mods-available and sites-available conf files.

What's the official way to enable mod_rewrite on Ubuntu?
zoon_unit is offline   Reply With Quote
Old September 11th, 2006   #2
tbonius
Gee! These Aren't Roasted!
 
tbonius's Avatar
 
Join Date: Jul 2006
Beans: 158
Re: How to enable mod_rewrite in Ubuntu server??

I assume you are talking about Apache2 directory structure for Ubuntu. This is the new and modular way all distributions will be laying out their Apache2 server config.

Mod_rewrite is compiled in by default. You can see it in the /etc/apache2/mods_available directory. If you feel like making doubly sure that it is loaded then simply put the following directive into httpd.conf:

Code:
LoadModule mod_rewrite /usr/lib/apache2/modules/mod_rewrite.so
You can verify what modules are loaded with:

Code:
sudo apache2ctl -l
T
__________________
..share what you know ..learn what you do not
tbonius is offline   Reply With Quote
Old September 11th, 2006   #3
zoon_unit
5 Cups of Ubuntu
 
Join Date: Jun 2006
Beans: 37
Thanks!

I actually found the following command that did the trick:

Code:
a2enmode rewrite
zoon_unit is offline   Reply With Quote
Old September 21st, 2006   #4
StFS
First Cup of Ubuntu
 
Join Date: Sep 2006
My beans are hidden!
Re: How to enable mod_rewrite in Ubuntu server??

And for future references, the "correct" way to define a new site (such as a new virtual host) is to create the definition in /etc/apache2/sites-available in its own file and then call:
Code:
a2ensite conf_file_name
to enable it.
StFS is offline   Reply With Quote
Old August 25th, 2007   #5
ookadoo
5 Cups of Ubuntu
 
ookadoo's Avatar
 
Join Date: Oct 2006
My beans are hidden!
Ubuntu 7.04 Feisty Fawn
Send a message via Yahoo to ookadoo
Re: Thanks!

Quote:
Originally Posted by zoon_unit View Post
I actually found the following command that did the trick:

Code:
a2enmode rewrite
The correct program name is a2enmod as in "apache2 enable module <module>":

Code:
a2enmod rewrite
ookadoo is offline   Reply With Quote
Old September 1st, 2007   #6
Pekz0r
5 Cups of Ubuntu
 
Join Date: Mar 2006
Beans: 19
Re: Thanks!

I'm also looking for a way to enable the rewrite mod to apache2.

i ran the commmand a2enmod rewrite and it said that the mod was addess successfully, but i can't see it in the list when i type: sudo apache2ctl -l

I've tried to make a rewirie rule to test but i'm not sure how to do it. This is what i've done:
In apache2.conf:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
In .htaccess (in var/www/mysite):
Code:
RewriteEngine on
RewriteRule /page/([0-9]+) /page.php?page=$1
It does not work. What have i done wrong?
Pekz0r is offline   Reply With Quote
Old September 4th, 2007   #7
wasert
Spilled the Beans
 
Join Date: Nov 2005
Beans: 14
Re: How to enable mod_rewrite in Ubuntu server??

I am having the same problem.

mod_rewrite is enabled
Code:
a2enmod rewrite
I edited my /etc/apache2/apache2.conf and added the following lines (following Plone's guide):
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^/(.*) http://localhost:8080/$1 [P]
</IfModule>
I tried adding a very simple RewriteRule and still didn't work
wasert is offline   Reply With Quote
Old September 4th, 2007   #8
Pekz0r
5 Cups of Ubuntu
 
Join Date: Mar 2006
Beans: 19
Re: How to enable mod_rewrite in Ubuntu server??

I've found out the solution!

Change AllowOverRide None in /etc/apache/sites-available/default to AllowOverRide All(or something else, but not None). Apache won't read the rewrite rules nor the .htaccess-files if AllowOverRide is set to None.

Hope that helps you too!

Last edited by Pekz0r; September 4th, 2007 at 03:50 AM..
Pekz0r is offline   Reply With Quote
Old September 4th, 2007   #9
wasert
Spilled the Beans
 
Join Date: Nov 2005
Beans: 14
Re: How to enable mod_rewrite in Ubuntu server??

still doesn't work



thanks for your help though
wasert is offline   Reply With Quote
Old September 4th, 2007   #10
Pekz0r
5 Cups of Ubuntu
 
Join Date: Mar 2006
Beans: 19
Re: How to enable mod_rewrite in Ubuntu server??

Is mod_rewite in the list loaded modules in phpinfo()?

Try putning the rewrite rules in a -htaccess file, that works for me
Pekz0r is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:47 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry