making seo/canonicals urls without mod-rewrite on lamp

99封情书 提交于 2019-12-10 12:38:32

问题


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

without using .htaccess and mod-rewrite? or i need to look for another hosting?


回答1:


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:

you have to setup your script to read the URL and then make parse it.

you can have:

/index.php/page1/page2.html

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.

if you can, you can try to hide the PHP by adding this:

<Files index>
ForceType application/x-httpd-php
</Files>

so you will endup with a url like: /index/page1/page2.html

source:

http://webarto.com/50/php-seo-url-function

http://www.daniweb.com/web-development/php/threads/95933



来源:https://stackoverflow.com/questions/8977602/making-seo-canonicals-urls-without-mod-rewrite-on-lamp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!