如何在地址栏中使用utf8网址

时间:2022-05-27 20:19:33

I'm trying to implement urls like the one below:

我正在尝试实现如下所示的网址:

  • www.example.com/contact-us

,but with one exception, that is I want it to be utf8, like the one below:

,但有一个例外,那就是我希望它是utf8,如下所示:

  • www.example.com/تماس-با-ما

How to do this? my webpages name are in English and I want it to be English.

这该怎么做?我的网页名称是英文的,我希望它是英文的。

1 个解决方案

#1


3  

Using .htaccess, you can redirect your visitors from /علیرضا to contact.php

使用.htaccess,您可以将访问者从/علیرضا重定向到contact.php

In your .htaccess, write like the following,

在.htaccess中,写如下,

RewriteEngine On
RewriteRule ^علیرضا$ contact.php

To display UTF-8 content and URLs in a page, you need to have the following in your head section.

要在页面中显示UTF-8内容和URL,您需要在头部中包含以下内容。

<meta content="text/html; charset=UTF-8" http-equiv="content-type">

In your anchor links, use utf-8 url in the href.

在你的锚链接中,在href中使用utf-8 url。

<a href="www.example.com/تماس-با-ما ">www.example.com/تماس-با-ما </a> 

An example of tamil url (UTF-8) is shown below.

泰米尔网址(UTF-8)的示例如下所示。

如何在地址栏中使用utf8网址

#1


3  

Using .htaccess, you can redirect your visitors from /علیرضا to contact.php

使用.htaccess,您可以将访问者从/علیرضا重定向到contact.php

In your .htaccess, write like the following,

在.htaccess中,写如下,

RewriteEngine On
RewriteRule ^علیرضا$ contact.php

To display UTF-8 content and URLs in a page, you need to have the following in your head section.

要在页面中显示UTF-8内容和URL,您需要在头部中包含以下内容。

<meta content="text/html; charset=UTF-8" http-equiv="content-type">

In your anchor links, use utf-8 url in the href.

在你的锚链接中,在href中使用utf-8 url。

<a href="www.example.com/تماس-با-ما ">www.example.com/تماس-با-ما </a> 

An example of tamil url (UTF-8) is shown below.

泰米尔网址(UTF-8)的示例如下所示。

如何在地址栏中使用utf8网址