Re: mod_rewrite in .htaccess does not work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/07/07, mailings@xxxxxxxxxx <mailings@xxxxxxxxxx> wrote:
good day

Hi

i'm trying to install some php cms system on my hompage's host
machine. there's a index file that is supposed to parse the path after
index, e.g. index/login, do the magic and render the login page. now
apparently the .htaccess file isn't properly followed and apache
actually tries to find a index/login file which doesn't exist. here's
the config:

There's a few odd choices in this config, I'll add them inline.


thanks for your help


my phpinfo output: http://softbee.ch/test.php


.htaccess:

####################################################################
# Sitellite Content Server
# http://www.sitellite.org/
#
# Copyright (c) 2001-2003 SIMIAN systems Inc.
#
# This software is released under the Simian Open License.
# Please see the accompanying file docs/LICENSE for licensing
# details!
####################################################################

# These directives are necessary in order to tell Apache to treat
# the file 'index' as a PHP script.  Avoiding the .php extension
# has some benefits, as some search engines don't parse .php files.
# Otherwise, you can simply rename this file with a .php extension
# and it should work fine with little or no modification.

Sounds like SEO rubbish to me. I've never heard of .php files being
ignored by search engines. That's not to say that removing .php is a
bad idea, on the contrary it makes your URLs independent of the
programming language used for the site (a good thing). Also, it's
possible to have apache send a request like /index/foo/bar to
/index.php using the "Options MultiViews" directive.


# Make sure PATH_INFO is available
<IfDefine APACHE2>
    AcceptPathInfo On
</IfDefine>

Remove the IfDefine here. It's rarely useful and just makes debugging
harder (do you know if it's set, for example?)


# Let Apache know that 'index' is really a PHP script in disguise.
<Files index>
    ForceType application/x-httpd-php
</Files>

# Let Apache know that 'sitellite' is also a PHP script in disguise.
<Files sitellite>
    ForceType application/x-httpd-php
</Files>

These two should really be SetHandler. ForceType "works" for the same
reason AddType "works" for enabling .php files; it's an old hack that
refuses to die.


# Make SCS the directory index handler (instead of index.html or index.php).
DirectoryIndex index index.html index.php

# Instruct Apache to treat XT templates as HTML files upon direct access.
# Useful for previewing.
AddType text/html .tpl

# Short tags are bad.
php_flag short_open_tag off

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
    RewriteCond %{REQUEST_FILENAME} -d [NC]
    RewriteRule .* - [L]
    RewriteRule ^(.+)$ index?_rewrite_sticky=$1 [QSA,L]
</IfModule>

Again, IfModule just confuses things so you should remove it.

It's not clear from your description if your htaccess file is being
read by the server. Try adding garbage to it (Wooga, for example) and
see if you get a 500 error. If not, you'll need to ask the server
administrator to enable htaccess files for mod_rewrite by setting:

AllowOverride FileInfo
Options FollowSymlinks

--
noodl

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux