Reputation: 83
I am new to URL rewrite, regex and .htaccess
Here is an issue I am facing:
I have this url with GET parameter:
www.mysite.in/alpha-beta/abc.php?id=APPLE%strike=200.00
I want to display it like:
www.mysite.in/alpha/beta/APPLE/200.00
This is the code in .htaccess:
RewriteRule ^alpha/beta/(.*)/([0-9]+(\.[0-9]+))$ alpha-beta/abc.php?id=$1&strike=$2 [NC,L]
But I only get a blank page when I go to URL: www.mysite.in/alpha/beta/APPLE/200.00
When I change the htaccess rule to:
RewriteRule ^alpha/beta/(.*)/([0-9]+(\.[0-9]+))$ http://www.mysite.in/alpha-beta/abc.php?id=$1&strike=$2 [NC,L]
It redirects to correct page but the URL is displayed as http://www.mysite.in/alpha-beta/abc.php?id=APPLE&strike=200.00
What seems to be the problem?
Upvotes: 1
Views: 624
Reputation: 786241
Use these rules in root .htaccess:
RewriteEngine On
RewriteRule ^OI_TOOL/IV/(.*)/([0-9]+(?:\.[0-9]+))/?$ OI_ANALYSIS_TOOL/iv_chart.php?symbol=$1&strike=$2 [NC,L,QSA]
# fix path for getIV.php by redirecting it to /OI_ANALYSIS_TOOL/
RewriteRule ^OI_TOOL/.+?/(getIV\.php)$ /OI_ANALYSIS_TOOL/$1 [L,NC,R=301]
Upvotes: 2