Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

making seo/canonicals urls without mod-rewrite on lamp

Tags:

seo

lamp

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?

like image 415
hanna Avatar asked Jan 23 '12 19:01

hanna


1 Answers

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

like image 86
Igor Kraskynlykov Avatar answered Oct 13 '22 23:10

Igor Kraskynlykov