Question

why doesn't this mod_rewrite work?

Hello,

I am facing an issue which I can’t resolve.

this is my .htaccess file <pre> Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([\w\d~%.:_-]+)$ index.php?page=$1 [QSA] RewriteRule ^news/([0-9]+) /news?id=$1 RewriteRule ^contact/([0-9]+) /contact?do=$1 RewriteRule ^account/([0-9]+) /account?action=$1 RewriteRule ^admin/([0-9]+) /admin?action=$1 </pre>

Everything works beside the admin and account rules when I go the one if the working once, Then I get to the requested page i.e www.domain.com/page or www.domain.com/news/3

All working rules are ending in numbers, like the news rules, But admin and account rule doesn’t end in a number, but in a string, like www.domain.com/account/settings

which doesn’t work.

Anyone able to help me?


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.

nwm I got it working :) <br> <br>Solution for others: <br>([0-9]+) only matches numbers. If you want to match Strings, use either (.+) to match every character or some other character group ([a-zA-Z]+ for example).