Mod_rewrite help


I need some help with my mod_rewrite.

  • Note, this is my first time trying to play with .htaccess

I have some rewrite rules in it already, which works fine, looks like this: Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([\w\d~%.:_-]+)$ index.php?page=$1 [QSA]

So when I go to then it goes to

what I need more is that, when they go to then it will go to I’ve tried with this line: RewriteRule ^news/([0-9]+) /news.php?id=$1

  • but do not work.

Any question is, would it be able to replace id number with the name of the post, like instead of it will be


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@Samuel <br> <br>yes I have :)

Have you set AllowOverride All on apache? /etc/apache2/sites-available/

No, I do not use WordPress, I prefer build my own :)