没有 mod_rewrite 的漂亮 URL,没有 .htaccess [英] Pretty URLs without mod_rewrite, without .htaccess

查看:21
本文介绍了没有 mod_rewrite 的漂亮 URL,没有 .htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果无法访问 .htaccess,我发现自己陷入了创作僵局.没有适合我的 mod_rewriting. 不过,我希望能够做一些不错的事情,例如:

Without a possibility to access .htaccess I find myself in a creative impasse. There is no mod_rewriting for me. Nevertheless, I want to be able to do the nice stuff like:

http://www.example.com/Blog/2009/12/10/
http://www.example.com/Title_Of_This_Page

我有哪些选择?

回应答案:

  • 我正在用 php5 构建
  • 我无权访问 .htaccess
  • http://www.example.com/index.php/Blog/ 是一种已知技术,但我不喜欢它.是显示 php 这么说.
  • 如何创建无扩展名的 PHP 文件?这会奏效吗?
  • 使用自定义 404 技术会对性能造成多大影响?
  • I'm building with php5
  • I don't have access to .htaccess
  • http://www.example.com/index.php/Blog/ is a known technique but I don't prefer it. Is shows the php so to say.
  • How would I create extensionless PHP-files? Would this do the trick?
  • How much would using the custom 404 technique hurt performance?

推荐答案

如果您有权限为您的服务器设置自定义错误文档,您可以使用它来重定向 404 请求.

If you've the permissions to set custom error documents for your server you could use this to redirect 404 requests.

例如对于 Apache (http://httpd.apache.org/docs/2.0/mod/core.html#errordocument)

E.g. for Apache (http://httpd.apache.org/docs/2.0/mod/core.html#errordocument)

ErrorDocument 404 /index.php

在 index.php 中,您可以使用 $_SERVER 数组中的数据处理您的请求.

In the index.php you then can proceed your request by using data from the $_SERVER array.

这篇关于没有 mod_rewrite 的漂亮 URL,没有 .htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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