Mod_rewrite Ubuntu?

0 like 0 dislike
49 views
Have configured a local server on your computer. LAMP. Everything works fine, but there is a problem with mod_rewrit'ohms. In .htaccess there is a line:


RewriteEngine on

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


But the page does not respond on localhost/article/1, but only on localhost/article.php/?id=1


On the host everything works.


"AllowOverride All" like there.


How to fix it?
by | 49 views

3 Answers

0 like 0 dislike
That says:
\r
sudo a2enmod rewrite
by
0 like 0 dislike
You forgot to add RewriteBase. Without it, you are redirected to the address /home/USER/public_html/article.php etc.
\r
Do this:
\r
RewriteEngine on
RewriteBase /
RewriteRule ^article/([0-9]+) article.php?id=$1 [L]
\r

\r
Well, for your needs a rule adjust (given other parameters). To check how are redirects, temporarily put R instead of L
by
0 like 0 dislike
Options FollowSymLinks
included? It is necessary to work mod_rewrite
by

Related questions

0 like 0 dislike
2 answers
asked Aug 3, 2019 by klast
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
28,728 users