I want to rewrite my URL, www.example.com/(language)/contact
into www.example.com/con.htm?lang=(language)
, so what should I use?
相关问题
- Backbone.js PushState routes .htaccess only workin
- Stop .htaccess redirect with query string
- .htaccess rule, redirecting old unexistent address
- UrlEncodeUnicode and browser navigation errors
- Improve converting string to readable urls
相关文章
- C# HttpClient.SendAsync always returns 404 but URL
- Prevent $anchorScroll from modifying the url
- How does a browser handle cookie with no path and
- Base64URL decoding via JavaScript?
- Multiple htaccess rewrite rule
- AWS ALB redirect to https
- rewrite urls for product name
- Should I url encode a query string parameter that&
First of all, check that you, on the distant server, have access to a
.htaccess
file in the root directory of the server.Now, you first need to type
in order for the rewrite to work.
Now, you can use the magical
RewriteRule
token. What is it? A rewrite rule.Now the way it works is pretty simple: The URL typed in is to be typed just next to
RewriteRule
, with(.*)
representing your variable, here(language)
. The output URL which is the URL to be crawled by the server is just after, and the content of the variable(.*)
we talked about above will be placed where$1
is.Giving us:
as the content of
.htaccess
for what you asked.Input:
Output:
And it works everytime!
Also you can add as many
RewriteRule
s as you want!