OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

.htaccess redirect, send last directory as a parameter

  • Thread starter Thread starter Denis Petrov
  • Start date Start date
D

Denis Petrov

Guest
I need to redirect domain.com/kiosk/m42 or domain.com/kiosk/m42/ to domain.com/kiosk/?m42 m42 — is a changeable part, it's could be s41, p39 or whatever...

I've tried

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI}  ^(.*)/kiosk/(\w+)/?$
RewriteRule  ^   %1/kiosk/?%2&%{QUERY_STRING}  [R=301,L]

or

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/kiosk
RewriteRule (.*)/([^/]+)/?$ https://my-bakery.ru/kiosk/?$2 [L,R=301,QSA]

but that doesn't work well. Where am i mistaken?
<p>I need to redirect <em>domain.com/kiosk/m42</em> or <em>domain.com/kiosk/m42/</em> to <em>domain.com/kiosk/?m42</em> <strong>m42</strong> — is a changeable part, it's could be <strong>s41</strong>, <strong>p39</strong> or whatever...</p>
<p>I've tried</p>
<pre><code>RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)/kiosk/(\w+)/?$
RewriteRule ^ %1/kiosk/?%2&%{QUERY_STRING} [R=301,L]
</code></pre>
<p>or</p>
<pre><code>RewriteEngine On
RewriteCond %{REQUEST_URI} ^/kiosk
RewriteRule (.*)/([^/]+)/?$ https://my-bakery.ru/kiosk/?$2 [L,R=301,QSA]
</code></pre>
<p>but that doesn't work well. Where am i mistaken?</p>
Continue reading...
 
Top