i have following code,
details.php working fine. but when i access gotolink.php its directing me again in details.php page which giving me 404 error, cuz its unexpected url..
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+)$ uk/details.php?pid=$1
RewriteRule ^([a-zA-Z0-9-/]+)/$ uk/details.php?pid=$1
RewriteRule ^([a-zA-Z0-9-/]+)$ gotolink/gotolink.php?id=$1
RewriteRule ^([a-zA-Z0-9-/]+)/$ gotolink/gotolink.php?id=$1
Please help!
The regular expression for
details.phpandgotolink.phpare identical, apache has no way to tell whetherhttp://domain.com/abc123should be rewritten to/uk/details.php?pid=abc123or/gotolink/gotolink.php?id=abc123because the URI,/abc123, matches both of these:The fact that the details.php one is first is why everything gets rewritten to details.php. If you swapped them around, everything would get rewritten to gotolink.php. You have to make it so these regular expressions match differently. Example:
So now
/d/abc123goes to/uk/details.php?pid=abc123and/g/abc123goes to/gotolink/gotolink.php?id=abc123. Or you can separate them if the details pid is always letters and gotolink id is always numbers or something: