1

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.

My no seo link:

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

Examples browser: mydomain.com/proyecto.php?id=1&title=diseno-desarrollo-web

My question is how can I convert this link SEO Friendly

This is my htaccess file on raiz, but it don´t work.

#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

DBE
  • 219
  • 4
  • 11
  • How are the input paths supposed to look like? What should `$1` and `$2` originate from? Why not rewrite to `proyecto.php` directly? – mario Mar 27 '16 at 19:35
  • my knowledge is zero in .htaccess, can you show me a example white rewrite directly to proyecto.php. My httpd.conf is active the LoadModule rewrite_module modules/mod_rewrite.so – DBE Mar 27 '16 at 19:43
  • What do you want the final uri to look like? – Roshan Bhumbra Mar 27 '16 at 19:44
  • Like this: mydomain.com/proyecto/1/diseno-desarrollo-web – DBE Mar 27 '16 at 19:47
  • If you don't know how those rules work, read some references first: [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/q/20563772) – mario Mar 27 '16 at 19:49
  • Thanxs for the reference page, i will look it. – DBE Mar 27 '16 at 20:04

1 Answers1

4
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]
Vigikaran
  • 677
  • 1
  • 9
  • 24
  • thanxs for the example @Vigikaran, but i have delete my htaccess file and introduced the example and it didn´t change nothing in the browser :(, tested in localhost and in my server. I do not know why – DBE Mar 27 '16 at 20:12