Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have php 5.3.8, apache 2.2.21, all is good, except mod_rewrite

by default LoadModule rewrite_module modules/mod_rewrite.so is enabled (not commented out)

ClearModuleList does not exist

AddModule mod_rewrite.c does not exist

and then you have

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

still i test mod_rewrite and it's not working, what more should i do?? if it wasn't for .htaccess i would have used nginx, by the way apache was installed by default when i got the vps and then i updated it but that didn't change the httpd.conf settings

do you think i should uninstall it and reinstall it by myself??? everyone say that mod_rewrite should not be enabled by default so i don't know why my apache is different

share|improve this question

migrated from stackoverflow.com Oct 11 '11 at 2:54

This question came from our site for professional and enthusiast programmers.

    
This question should be on serverfault. –  Raffael Luthiger Oct 10 '11 at 15:58
    
@RaffaelLuthiger then please migrate it because i don't want to ask it twice and then be told that this is a duplicated question, it happened before :D –  Eli Oct 10 '11 at 16:01
    
do you have any aliases? remove. –  Mido Oct 10 '11 at 16:02
1  
how did you test mod_rewrite? you need RewriteEngine On before RewriteRule in httpd.conf or .htaccess –  cuttinger Oct 10 '11 at 16:02
    
@mido i don't have aliases –  Eli Oct 10 '11 at 16:12

2 Answers 2

up vote 0 down vote accepted

Redirect directive belongs to mod_alias, not mod_rewrite.

To test the mod_rewrite, put the belows in .htaccess file in document root:

RewriteEngine On
RewriteRule (.*) http://google.com [R=301,L]

Make sure that you set AllowOverride All in <Directory "/document/root">

share|improve this answer
    
302 responce, I suppose, is better in common –  Lazy Badger Oct 11 '11 at 5:38
    
Smth. like RewriteRule ^one.html$ two.html is slightly better for local tests –  Lazy Badger Oct 11 '11 at 5:41

If you have PHP

<?php phpinfo(); ?>

Load that page up in your web browser, and perform a search for “mod_rewrite”. All being well, you’ll find it in the “Apache loaded modules” section of the page.

.htaccess before any RewriteRule must have RewriteEngine on

The structure of a RewriteRule

RewriteRule Pattern Substitution [OptionalFlags]

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.