简体   繁体   English

使用htaccess在php中的seo友好url

[英]seo friendly url in php using htaccess

I 'm fighting with htaccess XD, but I can not find the fault, because i don´t know much about htaccess, i have set the correct settings in the phpinfo file. 我正在使用htaccess XD,但我找不到故障,因为我对htaccess不太了解,所以我在phpinfo文件中设置了正确的设置。

My no seo link: 我的无seo链接:

<a href="proyecto?id=<?php echo $id_proyecto . '&title=' . $url; ?>">

Examples browser: mydomain.com/proyecto.php?id=1&title=diseno-desarrollo-web 示例浏览器:mydomain.com/proyecto.php?id=1&title=diseno-desarrollo-web

My question is how can I convert this link SEO Friendly 我的问题是如何转换此链接SEO Friendly

This is my htaccess file on raiz, but it don´t work. 这是我在raiz上的htaccess文件,但是不起作用。

#Whitout PHP

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

RewriteBase /
RewriteRule ^proyecto/([a-zA-Z0-9\-/\.]+)/?$ proyecto?id=$1title=$2 [L]

thanks in advance 提前致谢

RewriteEngine On
RewriteRule ^proyecto/([^/]*)/([^/]*)$ /proyecto.php?id=$1&title=$2 [L]

and add the following at the bottom 并在底部添加以下内容

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM