user2891084
user2891084

Reputation: 111

Htaccess redirec by parameters name

I want to know if ti´s possible to diferenciate between two urls with same number of parameters but different parameters names.

this is what i Have. But the htaccess always return the first option :-(

Somebody can point me in the right way??

these are the url´s

https://xxxxxx/videos.php?categoria=Mimo&orden=fecha

https://xxxxxx/videos.php?orden=views&limit=5

and this is how i want to see it

https://stars.pullmantur.es/pull/Mimo/Fecha

https://stars.pullmantur.es/pull/views/5
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^categoria=([A-Za-z\+]+)&orden=([A-Za-z0-9\+]+)$
RewriteRule videos\.php$ participantes-casting-online/%1/%2? [R=301,L]
RewriteRule ^participantes-casting-online/([^/]*)/([^&]+)$ videos.php?categoria=$1&orden=$2 [L,NC,QSA]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^orden=([A-Za-z\+]+)&limit=([,0-9\+]+)$
RewriteRule videos\.php$ participantes-casting-online/%1/%2? [R=301,L]
RewriteRule ^participantes-casting-online/([^/]*)/([^&]+)$ videos.php?orden=$1&limit=$2 [L,NC,QSA]

Thank You

Upvotes: 0

Views: 174

Answers (1)

anubhava
anubhava

Reputation: 784868

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+videos\.php\?orden=([&]+)&limit=([0-9]+) [NC]
RewriteRule ^ /pull/%1/%2? [R=302,L]

RewriteCond %{THE_REQUEST} \s/+videos\.php\?categoria=([^&]+)&orden=([^\s&]+) [NC]
RewriteRule ^ /pull/%1/%2? [R=302,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^pull/([^/]+)/([0-9]+)/?$ /videos.php?orden=$1&limit=$2 [L,NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^pull/([^/]+)/([0-9]+)/?$ /videos.php?categoria=$1&orden=$2 [L,NC,QSA]

Upvotes: 1

Related Questions