How can i have .htaccess make example from title ? Visitor will type in his browser http://mydomain.tld/somedomain.tld and my whois s开发者_JAVA技巧cript should process http://mydomain.tld/index.php?name=somedomain.tld and return whois result.
Thanks
Use Apache's mod_rewrite
.
RewriteEngine on
RewriteRule ^(.*)$ http://mydomain.tld/index.php?name=$1 [NC]
(Not tested, so read up on mod_rewrite
if this doesn't work precisely as you'd like it to.)
Try following rule in your .htaccess file:
RewriteEngine on
Options +FollowSymlinks -MultiViews
RewriteCond %{QUERY_STRING} !^name= [NC]
RewriteRule ^([^/]*)/?$ /index1.php?name=$1 [L,R=301,NE,QSA]
RewriteCond above will prevent infinite redirections.
NC
No Case comparison
R=301
will redirect with https status 301
L
will make last rule
NE
is for no escaping query string
QSA
will append your existing query parameters
$1
is your REQUEST_URI
精彩评论