1

The real url format is

http://localhost/myfolder/index.php?url=login/register&step=1

After mod rewrite I get

http://localhost/myfolder/login/register/step/1

All good but how can I get the value of step in a php file.If I do $_GET['step'] then I get nothing.

My htaccess

Options -MultiViews

# turn rewriting on
RewriteEngine On

# When using the script within a sub-folder, put this path here, like /mysubfolder/
# If your app is in the root of your web folder, then please delete this line or comment it out
RewriteBase /mybb/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-l


RewriteRule ^(.*)/(.*) index.php?url=$0&step=$2 [L,QSA]
tereško
  • 57,247
  • 24
  • 95
  • 149
Raj
  • 1,335
  • 5
  • 22
  • 44

1 Answers1

0

Change your rule to:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)(?:/(step)/([0-9]+))?/?$ index.php?url=$1&$2=$3 [NC,L,QSA]
anubhava
  • 713,503
  • 59
  • 514
  • 593
  • You are just brilliant.Thanks a lot for saving my life.Answer accepted but can't vote up as it says minimum 15 reputation required.Sorry. – Raj Jul 03 '14 at 11:04