Question

so this is my url:

http://www.mysite.com/mypage.php?PropertyBuyRent=rent&Developer=&Resort=&City=&State=&Country=&Price=

I want to write the following htaccess:

if PropertyBuyRent=rent and Resort value is not empty then url should be like:

http://www.mysite.com/mypage.php/TimeshareForRent/Marriott's+Grande+Ocean+Resort (whatever value comes from the url for Resort)

Was it helpful?

Solution

You can use this rule:

RewriteEngine On

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(testing/mypage\.php)\?PropertyBuyRent=rent&Developer=&Resort=([^&]+)&City=&State=&Country=&Price= [NC]
RewriteRule ^ /%1/TimeshareForRent/%2? [R=301,L,NE]

RewriteRule ^(testing/mypage.php)/TimeshareForRent/([^/]+)/?$ /$1?PropertyBuyRent=rent&Developer=&Resort=$2&City=&State=&Country=&Price= [L,NC,QSA]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top