Home RewiteRule not working in .htaccess
Reply: 0

RewiteRule not working in .htaccess

user1073
1#
user1073 Published in May 25, 2018, 6:28 pm

I'm making a website in PHP and I've got to the part where I need to make a news page. I have already written the news.php file and it uses GET to read the particular title of the article to display. That means I end up with an URL like

/community/news.php?title=post-title

And I much rather it to be like

/community/news/post-title

So I looked it up and saw I could do it with the .htaccess file.

Now, my actual .htaccess file looks exactly like this

ErrorDocument 404 /notfound.php

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

# /community/news/post-title -> /community/news.php?title=post-title
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^community/news/([^/]*)$ /community/news.php?title=$1 [L]

</IfModule>

And he result of going to /community/news/post-title it's an 404 Error

Thank you so much for your help.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.318666 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO