Page 1 of 1

mod rewrite

Posted: Fri Nov 25, 2005 3:39 pm
by s.dot
I recently transferred from shared hosting to my own dedicated server. My mod rewrite rules don't work on the new server, so I figure there's something in the httpd.conf file that I need to edit. I've looked through it, but I can't seem to find anything.

Posted: Fri Nov 25, 2005 4:07 pm
by Buddha443556
Got ...

Code: Select all

LoadModule rewrite_module modules/mod_rewrite.so
... and ...

Code: Select all

AddModule mod_rewrite.c
... in your httpd.conf? Might be commented out.

Posted: Fri Nov 25, 2005 4:27 pm
by pickle
In addition to what ~Buddha443556 said, there may be another part of the conf file that allows modules to be activated in particular directories. By default, what *is* allowed is pretty restricted - hosts have to open it up a bit. Here's an example from one of my servers:

These were the original lines

Code: Select all

<Directory "SYS:/APACHE2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride none
    Order allow,deny
    Allow from none
</Directory>
These are the changed lines

Code: Select all

<Directory "SYS:/APACHE2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

Posted: Fri Nov 25, 2005 4:35 pm
by s.dot
This is what my httpd.conf looks like

Code: Select all

LoadModule rewrite_module     libexec/mod_rewrite.so

// further down

AddModule mod_rewrite.c

// neither one of those are commented out

// even further down

# First, we configure the "default" to be a very restrictive set of
# permissions.
#
<Directory />
Options All
AllowOverride All
</Directory>


// Further down
<Directory "/usr/local/apache/htdocs">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Posted: Fri Nov 25, 2005 5:21 pm
by Buddha443556
Got this in your htaccess?

Code: Select all

RewriteEngine on
Here's a real long shot ... maybe someone changed AccessFileName?

Code: Select all

AccessFileName .htaccess
Yep ... I'm running out of ideas. No error message anywhere?

Posted: Fri Nov 25, 2005 5:26 pm
by s.dot
.htaccess

Code: Select all

Options -Indexes

RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)(/)?$ showme.php?u=$1
RewriteRule ^photos/([a-zA-Z0-9_-]+)(/)?$ /albums.php?u=$1
RewriteRule ^photos/([a-zA-Z0-9_-]+)/([0-9]+)(/)?$ /albums.php?u=$1&aid=$2
RewriteRule ^blog/([a-zA-Z0-9_-]+)(/)?$ /blogit.php?busername=$1
this is the line you mentioned

Code: Select all

AccessFileName .htaccess
What should be happening:
http://204.15.77.162/~scott/showme.php?u=scrotaye should be rewriting to
http://204.15.77.162/~scott/scrotaye

as you can tell by clicking on the links, the first one works, and the second one doesn't.

and as far as the error logs go, I don't know. this is my first time working with ssh and a dedicated server and freebsd, so I feel very n00b. I don't know where the error logs are yet.

Posted: Fri Nov 25, 2005 7:08 pm
by Chris Corbyn
A bit of a long shot. But have you restarted the Apache service? :P

Posted: Fri Nov 25, 2005 7:25 pm
by s.dot
rebooted the whole system :-P

:( im really at a loss here. if someone likes, I will PM them the whole httpd.conf file... if someone is willing to take a look at it.

Posted: Fri Nov 25, 2005 7:33 pm
by josh
mod_rewrite never works on temp URLS (/~something), should work after pointing your domain (always been the case with me at least).

Posted: Fri Nov 25, 2005 9:34 pm
by Buddha443556
How about rewritebase?