Report this

What is the reason for this report?

why doesn't this mod_rewrite work?

Posted on November 3, 2013

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?



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!

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.

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).

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.