1

I'm trying to rewrite my url in a project in wamp service but can't get it working.

I want to rewrite based on these two rules basically

FROM:

  • localhost/project/modulos/tags/edit/3

TO:

  • localhost/project/modulos/tags/index.php?action=edit&id=3

AND FROM:

  • localhost/project/modulos/tags/lis

TO:

  • localhost/project/modulos/tags/index.php?action=list

My htaccess is like this:

<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^modulos\/(.*)\/(.*)$ index.php?action=%1&id%2 </IfModule> 
3
  • 1
    what exactly is not working for you? Commented Jun 15, 2016 at 3:29
  • 1
    if you don't want to rewrite URL, you can remove htaccess file or delete the rewrite code in htaccess file Commented Jun 15, 2016 at 5:11
  • starkeen, It just don't do anything. Raj_King, I want to rewrite my URL. Commented Jun 15, 2016 at 12:06

1 Answer 1

1

You are using %1 and %2 instead, they should be $1 and $2 respectively. Putting more specific rules first:

RewriteEngine on RewriteBase modulos/ RewriteRule ^modulos/([^/]+)/([^/]+)/([^/]+)/?$ $1/index.php?action=$2&id=$3 [L] RewriteRule ^modulos/([^/]+)/([^/]+)/?$ $1/index.php?action=$2 [L] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.