1

I have this url

www.mysite.com/proyecto.php?id=3

and want this type of url

www.mysite.com/proyecto/id/3

I remember using this kind of code but is not working, any idea please?

<ifModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule proyecto/id/(.*)/ proyecto.php?id=$1
RewriteRule proyecto/id/(.*) proyecto.php?id=$1

RewriteRule ^([^\.]+)$ $1.php [NC,L]

ErrorDocument 404 /error404.php
</ifModule>

Finally I improved a bit and I did www.mysite.com/proyecto/1 width the following code in the .htaccess Thanks for the help!

RewriteEngine On 
RewriteRule    ^proyecto/([0-9]+)/?$    proyecto.php?id=$1    [NC,L]

1 Answers1

0

Your code sample looks very confusing and does not match your verbal description at all. If I got you right, this is main part you are looking for:

RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteCond %{REQUEST_URI} !^proyecto/id/(\d+)/? [NC]
RewriteCond %{QUERY_STRING} ^id=(\d+) [NC]
RewriteRule ^.*$ proyecto/id/%1/? [NC,L,R=301]
wp78de
  • 18,207
  • 7
  • 43
  • 71