LinuxQuestions.org
Help answer threads with 0 replies.
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 08-28-2010, 06:46 AM   #1
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Rep: Reputation: 0
Apache: rewritten links return 404 error, AllowOverride makes things even worse


I can't seem to make the mod_rewrite work on my website. The website in question is a joomla, which is using a joomla default .htaccess file.

In my httpd.conf file I have mod_rewrite module loaded, and I know I have to enable AllowOverride on the document root directory, to make it work, but when I do so, every link on my website prompt's a download (and I don't want my visitors to download the index.php file!!). If I set AllowOverride to None, the website loads normally, however rewritten links return a 404 error.

General document root is set to /var/www <- I serve multiple websites from this directory.

Here's what I have set-up for the website in question (I have tried with Options Indexes FollowSymlinks, but it doesn't change anything):
Code:
<Directory "/var/www/mladi/htdocs">
        Options None
        AllowOverride All
        Order allow,deny
        Allow from all
</Directory>
Also, I have multiple domains on the server, so I'm using virtual hosts. The relevant directive:
Code:
<VirtualHost *>
        ServerAdmin info@example.com
        ServerName www.example.com
        ServerAlias example.com

        # Document root
        DocumentRoot /var/www/mladi/htdocs

        # CGI Directory
        ScriptAlias /cgi-bin/ /var/www/mladi/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>

        # Log files
        ErrorLog /var/www/mladi/logs/error.log
        CustomLog /var/www/mladi/logs/access.log combined
</VirtualHost>

<VirtualHost *>
        ServerName mail.example.com
        DocumentRoot /usr/share/squirrelmail
</VirtualHost>
 
Old 08-28-2010, 08:48 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,909

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,

You should at least have:
Code:
Options FollowSymlinks
if you want to use mod_rewrite

You need the "AllowOverride All" if you want to use .htaccess, and I guess joomla uses .htaccess for rewrites and other stuff.

Quote:
but when I do so, every link on my website prompt's a download (and I don't want my visitors to download the index.php file!!
That means that you also need:
Code:
AddType application/x-httpd-php .php
Regards
 
1 members found this post helpful.
Old 08-28-2010, 04:05 PM   #3
craseal
LQ Newbie
 
Registered: Aug 2010
Posts: 12

Original Poster
Rep: Reputation: 0
I had AddType application/x-httpd-php5 .php, it turns out it works fine if I write php instead of php5.

Thanks!
 
  


Reply

Tags
apache, joomla, 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
Apache error: 404 Not Found, why? cucolin@ Ubuntu 3 08-14-2006 11:01 AM
Unwanted 404 error with apache Vossy Linux - Software 0 12-26-2005 08:31 PM
Apache - CGI include gives 404 error gargsuchi Debian 0 12-24-2005 10:08 AM
why is apache giving me a 404 error linuxmandrake Linux - Software 4 06-17-2005 09:16 AM
odd Apache 404 error Seventh Linux - Software 1 03-27-2005 03:43 AM


All times are GMT -5. The time now is 01:16 PM.

Main Menu
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