/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
rewrite
Fra : KG Import


Dato : 22-12-05 17:19

htaccess rewrite seo PHP
I am making a PHP site and want it to be SEO friendly also. I am stuck at
..htaccess rewrite and have already wasted many hours. What I want is
http://www.mysite/1.html to redirect to http://www.mysite/abc.php?id=1

and

http://www.mysite/place/name.html to redirect to
http://www.mysite/place/abc.php?id=name
Svar ------------------------------------
RewriteEngine On
RewriteRule ^([0-9]+).html /abc.php?id=$1 [QSA,L]
RewriteRule ^place/([a-z-]*).html /place/abc.php?id=$1 [QSA,L]

([0-9]+) will allow any digit, and only any digit, 1 or more.
([a-z-]*) will allow any combination of lower case letters, plus - if you
are using that for word separation, 0 or more instances. If you want it to
support upper case too, make it:
([a-zA-Z-]*)

[QSA,L] will append this to your internal scripting query string, and make
it the Last rewrite rule executed.
http://www.webconfs.com/dynamic-urls-vs-static-urls-article-3.php
-------------------------
http://www.webconfs.com/url-rewriting-tool.php



 
 
Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408527
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste