Вопрос

Hello I want to create my sites links to dynamically, and for me need to create links in .htacces from

http://rude.su.lt~/veikutis/katalogas.php?link=dulkiu-siurbliai&id=1

to

http://rude.su.lt/~veikutis/dulkiu-siurbliai/1/

in PHP I redirect firs link to second link with function:

header("HTTP/1.1 301 Moved Permanently");
header('Location: '.$location);

and now for me need to open that file.

Это было полезно?

Решение

The following is untested, of course, but should get you started:

RewriteEngine On
RewriteRule  ^~veikutis/([a-zA-Z-]+)/(\d+)/? ~veikutis/katalogas.php?link=$1&id=$2 [L,QSA]

Two components /([a-zA-Z-]+) and /(\d+) are captured as $1, $2 and an optional trailing slash is included at the end /?.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top