LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 12-21-2007, 06:02 PM   #1
emil2k
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:

http://www.webune.com/forums/viewtopic-p-62.html

Quote:
.htaccess
Code:
RewriteEngine On
RewriteRule ^link([^/]*)\.html$ rewrite.php?link=$1 [L]
rewrite.php
Code:
<h2 align=center>
<?
// mod_rewrite Test Page
// Copyright 2006 Webune.com
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";}
?>
</h2>

<hr>

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

<body>
<p align="center">by <a href="http://www.webune.com">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="http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html">Go back to webune forums.</a></p>
</body>
</html>
When I click the second link it simply shows a 404, this is what I put in the httpd.conf for this:

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

Rep: Reputation: 16
Quote:
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:
Code:
LoadModule rewrite_module modules/mod_rewrite.so
Did you make the symlink for that?
Also, what does the error log file from Apache have to say when you click the LINK2?

Thanks,
James Glenn
www.thedonkdonk.net
 
  


Reply

Tags
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 11:19 PM.

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