L
L
LB7772015-07-05 08:37:35
Nginx
LB777, 2015-07-05 08:37:35

How to make a redirect in .htaccess to a dynamic page?

For each new build, jenkins generates a new link ( site.com/version-5.0.333 ) where the site is located, i.e. version-5.0.333 is dynamic data, and the site has some pages that need to be redirected to the root, i.e. at site.com/version-xxxxx/.
How to register in .htaccess, a dynamic address, so that from some pages it would go to it?
Please write an example.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2015-07-05
@mblp

I'm afraid using .htaccess is not possible. Generate a link directly on the page. Get a list of directories, sort in descending order, get the last element with "version-"
Something like this.

S
ShamblerR, 2015-07-06
@ShamblerR

RewriteCond %{REQUEST_URI} ^!урл_который_не_перенаправлять$
RewriteCond %{REQUEST_URI} ^!урл_который_не_перенаправлять2$
RewriteCond %{REQUEST_URI} ^!урл_который_не_перенаправлять3..$
RewriteRule ^(.*)$ Регулярка_старая_версия новая_версия_урла  [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question