mod rewrite

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

mod rewrite

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post 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.
Last edited by Buddha443556 on Fri Nov 25, 2005 5:22 pm, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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>
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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>
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post 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?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

A bit of a long shot. But have you restarted the Apache service? :P
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

mod_rewrite never works on temp URLS (/~something), should work after pointing your domain (always been the case with me at least).
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

How about rewritebase?
Post Reply