A
A
Artqookie2011-02-06 18:00:37
Apache HTTP Server
Artqookie, 2011-02-06 18:00:37

Mod_rewrite Ubuntu?

There is a configured local server on a computer. LAMP. Everything works great, but there is a problem with mod_rewrit. There are lines in .htaccess:
RewriteEngine on
RewriteRule ^article/([0-9]+)/? article.php/?id=$1 [QSA,L]
But the page does not respond to localhost/article/1 , but only to localhost/article.php/?id=1
Everything works on the hosting.
"AllowOverride All" seems to be there.
How to fix?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
r0b1n, 2011-02-06
@r0b1n

What does it say in:

sudo a2enmod rewrite

H
holivar, 2011-02-06
@holivar

You forgot to add RewriteBase. Without it, you are redirected to /home/USER/public_html/article.php and so on.
Do this:

RewriteEngine on
RewriteBase /
RewriteRule ^article/([0-9]+) article.php?id=$1 [L]

Well, adjust the rule to your needs (taking into account other parameters). To check how redirects are going, temporarily replace L with R

C
charon, 2011-02-07
@charon

Options FollowSymLinks
enabled? This is required for mod_rewrite to work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question