php - htaccess condition in 301 -
i sure there other threads on similar topics around web. can't working on own website. please me
my site working in subdomain
for eg http://demo.example.com/sitename/india
if put 1 parameter (india) only. loading profile.php?countryname=india
working good.
but when add multiple parameters url this
http://demo.example.com/sitename/india/tamilnadu/chennai
i want load profile.php?countryname=india&state=tamilnadu&city=chennai
.
i try code
rewritecond %{http_host} ^demo\.example\.com/sitename$ rewriterule (.*) walola/$1/$2 [r=301,l] rewriterule ^([a-za-z0-9_-]+)$ sitename/profile.php?countryname=$1&state=$2 [qsa]
when pass single parameter url working otherwise shows 404 error.
please guide me.
***answer*** rewritecond %{http_host} ^demo\.example\.com/sitename$ rewriterule (.*) sitename/([^/.]+)/([^/.]+) [r=301,l] rewriterule ^([a-za-z0-9_-]+)/([a-za-z0-9_-]+)$ sitename/profile.php?countryname=$1&state=$2 [qsa]
its works good.
please try this
rewriterule ^(.*)/(.*)$ sitename/profile.php?countryname=$1&state=$2 [qsa]
or else send full url profile.php
page , split using php.
i.e.,
rewriterule ^/* sitename/profile.php?site=%{request_uri} [l,nc,qsa]
Comments
Post a Comment