隐藏网址目录 [英] hide url directory

查看:31
本文介绍了隐藏网址目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站:

www.mydomain.com/subfolder/subfolder/index.php

如何始终从 url 中隐藏目录名称.我的意思是始终在页面更改时从 url 中隐藏 2 个子文件夹的名称.
示例:
这些网址:

How could always hide the directory names from the url. I mean always hide the 2 subfolders' names from the url as the page changes.
Example:
These urls:

www.mydomain.com/subfolder/subfolder/index.php
www.mydomain.com/subfolder/subfolder/about.php
www.mydomain.com/subfolder/subfolder/contact.php
...

变成:

www.mydomain.com/index
www.mydomain.com/about
www.mydomain.com/contact
...

我也想使用最后提到的 url 来请求这些页面,而不需要输入一个可怕的长 url.

I want to use the last mentioned urls for requesting these pages, too, without typing a horrible long url.

推荐答案

如果您可以访问重写引擎,则可以使用类似于以下的简单重写模式:

If you have access to the Rewrite engine, you can use a simple rewriting pattern similar to this:

RewriteRule ^/(.*)$ /subfolder/subfolder/$1.php

这篇关于隐藏网址目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆