1

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

9
  • This question should be on serverfault. Oct 10, 2011 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
    – Lynob
    Oct 10, 2011 at 16:01
  • do you have any aliases? remove.
    – Mido
    Oct 10, 2011 at 16:02
  • 1
    how did you test mod_rewrite? you need RewriteEngine On before RewriteRule in httpd.conf or .htaccess
    – cuttinger
    Oct 10, 2011 at 16:02
  • @mido i don't have aliases
    – Lynob
    Oct 10, 2011 at 16:12

2 Answers 2

0

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">

2
  • 302 responce, I suppose, is better in common Oct 11, 2011 at 5:38
  • 1
    Smth. like RewriteRule ^one.html$ two.html is slightly better for local tests Oct 11, 2011 at 5:41
0

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]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .