无需在灯上进行mod-rewrite即可制作seo/canonicals url [英] making seo/canonicals urls without mod-rewrite on lamp
问题描述
我有一个托管公司,不允许在linux,php,mysql和apache上使用.htaccess(已禁用mod-rewrite).
i have a hosting company that does not allow .htaccess (mod-rewrite is disabled) on linux, php, mysql and apache.
我希望网址对我的网站来说更具搜索引擎优化/规范性.我现在有:
i want urls to be more seo/canonicals for my site. i have now:
/index.php
/flowers.php?id=41
/flowers.php?type=deco&mode=texture&color=red
etc...
有没有办法写类似这样的东西:
is there a way to write something like:
/home
/flowers/12
/flowers/deco/texture/red
不使用.htaccess和mod-rewrite?还是我需要寻找另一个托管服务?
without using .htaccess and mod-rewrite? or i need to look for another hosting?
推荐答案
如果不使用自定义方法(例如Wikipedia),则不能使用.就像@BookOfZeus所说的那样,您需要启用mod-rewrite来启用它.我会推荐它!
If you don't use a custom method (like the wikipedia for example) you can't. Like @BookOfZeus said, you need to enable mod-rewrite to do so. I would recommend it!
现在,您可以执行以下操作:
now, here's what you can do:
您必须设置脚本以读取URL,然后进行解析.
you have to setup your script to read the URL and then make parse it.
您可以拥有:
/index.php/page1/page2.html
/index.php/page1/page2.html
,因此脚本将读取$ _SERVER ['PATH_INFO'],然后拆分为'/'.因此,您将得到一个数组,然后可以执行逻辑来分离内容.
so the script will read the $_SERVER['PATH_INFO'] then split in the '/'. so you will an array, then you can do your logic to separate the content.
如果可以的话,您可以尝试通过添加以下代码来隐藏PHP:
if you can, you can try to hide the PHP by adding this:
<Files index>
ForceType application/x-httpd-php
</Files>
所以您最终将获得一个网址,例如:/index/page1/page2.html
so you will endup with a url like: /index/page1/page2.html
来源:
http://webarto.com/50/php-seo-url-function
http://www.daniweb.com/web-development/php/线程/95933
这篇关于无需在灯上进行mod-rewrite即可制作seo/canonicals url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!