Home RewiteRule not working in .htaccess

# RewiteRule not working in .htaccess

1#
Adan Sandoval Published in 2017-10-27 22:04:31Z
 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 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]  And he result of going to /community/news/post-title it's an 404 Error Thank you so much for your help.
Sinisa
2#
 If you work in local environment and your url is like http://localhost/website/community/news/post-title the you should have "website" in "RewriteBase /" RewriteBase /website 
 So, assuming your url is example.com - (the QSA flag appends the query string string to the url) RewriteEngine On ErrorDocument 404 example.com/notfound.php # /community/news/post-title -> /community/news.php?title=post-title RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^community/news/(.*)$example.com/community/news.php?title=$1 [L,QSA] 
 Thanks a lot for your help. Turns out it was an issue with relative paths. It worked with:  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]  (the difference is in the '/'s of the last line)