如何在URL中使用特殊字符(?)

时间:2022-09-13 09:01:36

I have developed a website using Raw PHP. I have used special character (? and ~) in URL. Example: http://webdeveloperszone.com/?~=portfolio .

我使用Raw PHP开发了一个网站。我在URL中使用了特殊字符(?和〜)。示例:http://webdeveloperszone.com/?〜= portfolio。

Now, I want to rebuild this website using wordpress or codeigniter. I want to keep all the existing link live, because google has cached those links. That means, I have to create links which supports special character (? and ~).

现在,我想使用wordpress或codeigniter重建这个网站。我希望保留所有现有链接,因为谷歌已经缓存了这些链接。这意味着,我必须创建支持特殊字符(?和〜)的链接。

Can any one tell me how can I do this?

谁能告诉我怎么能这样做?

3 个解决方案

#1


PHP

string urlencode ( string $str );
string urldecode ( string $str );

JavaScript

encodeURI(uri);
decodeURI(encodeURI(uri));

#2


For codeigniter

Have a look on

看看吧

https://ellislab.com/codeigniter/user-guide/general/urls.html

Enable query string

启用查询字符串

And change

$config['controller_trigger'] = 'c';

To

$config['controller_trigger'] = '~';

#3


In wordpress just you need to create page. and then change post name from database as you like.

在wordpress中,您只需要创建页面。然后根据需要更改数据库中的帖子名称。

Create page named portfolio.

创建名为portfolio的页面。

save and publish it.

保存并发布它。

then go to phpmyadmin.

然后去phpmyadmin。

open wp_posts.

get the record for perticular page. and change post_name to your slug ?~=portfolio.

获取特定页面的记录。并将post_name更改为你的slug?〜=投资组合。

That's it.

#1


PHP

string urlencode ( string $str );
string urldecode ( string $str );

JavaScript

encodeURI(uri);
decodeURI(encodeURI(uri));

#2


For codeigniter

Have a look on

看看吧

https://ellislab.com/codeigniter/user-guide/general/urls.html

Enable query string

启用查询字符串

And change

$config['controller_trigger'] = 'c';

To

$config['controller_trigger'] = '~';

#3


In wordpress just you need to create page. and then change post name from database as you like.

在wordpress中,您只需要创建页面。然后根据需要更改数据库中的帖子名称。

Create page named portfolio.

创建名为portfolio的页面。

save and publish it.

保存并发布它。

then go to phpmyadmin.

然后去phpmyadmin。

open wp_posts.

get the record for perticular page. and change post_name to your slug ?~=portfolio.

获取特定页面的记录。并将post_name更改为你的slug?〜=投资组合。

That's it.