Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 12-21-2007, 06:02 PM   #1
LQ Newbie
Registered: Dec 2007
Posts: 4

Rep: Reputation: 0
Unhappy .htaccess Not Working?

I'm having trouble with .htaccess files running mod_rewrite, I enabled the rewrite module with a symlink and changed the AllowOverride to All and reloaded and it still doesn't do the simple check found here:

RewriteEngine On
RewriteRule ^link([^/]*)\.html$ rewrite.php?link=$1 [L]
<h2 align=center>
// mod_rewrite Test Page
// Copyright 2006
if($_GET['link']==1){echo"You are not using mod_rewrite";}
elseif($_GET['link']==2){echo"Congratulations!! You are using Apache mod_rewrite";}
else{echo"Linux Apache mod_rewrte Test Tutorial";}


<title>How To Test mod_rewrite in Apache Linux Server</title>

<p align="center">by <a href="">Webune</a></p>
<p><a href="rewrite.php?link=1">LINK1</a> = rewrite.php?link=1</p>
<p><a href="link2.html">LINK2</a> = link2.html</p>
<p>How this works: both links are for this same page, except they both are different. link one is without the mod_rewrite and link2 is using mod_rewrite. Link1 show the php file, with with mod_rewrite we are mascarading the php file into a html file. you can use whatever type of extension you want, you can change it to .htm or .shtml etc... all you have to do is to make sure you also chang it in the .htaccess file</p>
<p>&lt;&lt; <a href="">Go back to webune forums.</a></p>
When I click the second link it simply shows a 404, this is what I put in the httpd.conf for this:

<Directory /var/www>
        AllowOverride All
Old 12-22-2007, 02:04 AM   #2
Registered: Oct 2005
Location: San Antonio, TX
Distribution: Fedora, RHEL 6, CentOS 6, Debian 6, Arch, Gentoo
Posts: 136

Rep: Reputation: 16
Originally Posted by emil2k View Post
I enabled the rewrite module with a symlink ...
Not sure what you did here. How did you enable the rewrite module with a symlink?

Usually there is an line in the httpd.conf file that reads:
LoadModule rewrite_module modules/
Did you make the symlink for that?
Also, what does the error log file from Apache have to say when you click the LINK2?

James Glenn


htaccess, modrewrite

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess + .htpasswd not working nazs Linux - Security 1 05-17-2006 10:28 PM
.htaccess NOT WORKING! SpiderIRE Linux - Software 2 10-04-2005 05:06 PM
.htaccess stops working adm1329 Linux - Networking 6 05-26-2004 01:56 PM
apache .htaccess basic authentication not working quite right kleptophobiac Linux - Software 3 01-10-2004 03:43 PM
.htaccess was working, now it's not! WorldBuilder Linux - General 6 09-22-2003 03:08 PM

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration