Need assistance with regards to htaccess - php

I want to convert this url:
http://something.com/FLSD/DSS/?d=624
Into this:
http://something.com/FLSD/DSS/624/
How do I do that?

Add this to your .htaccess file:
RewriteEngine On
RewriteBase /
RewriteRule ^FLSD/DSS/([0-9]+)/?$ /FLSD/DSS/?d=$1

This should work:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /FLSD/DSS/\?d=([0-9]+)\ HTTP
RewriteRule ^ /FLSD/DSS/%2\? [R=301,L]
RewriteRule ^FLSD/DSS/([0-9]+)/?$ /FLSD/DSS/?d=$1 [L]
It will convert http://something.com/FLSD/DSS/?d=624 into http://something.com/FLSD/DSS/624/

Related

Hide get parametres

Get:
https://xxx.ru/page/?page=update-1/
how to show:
https://xxx.ru/page/update-1/
I tried does not work
.htaccess
RewriteBase /
RewriteEngine on
RewriteRule ^page\/(.*?)/?$ page/?page=$1 [L,QSA]
You can use:
RewriteEngine on
RewriteBase /
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+page/\?page=([^\s&]+) [NC]
RewriteRule ^ /page/%1? [R=302,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^page/(.+)$ page/?page=$1 [L,QSA,NC]
Use this:
RewriteEngine On
RewriteRule ^page/([^/]*)$ /page/?page=$1 [L]
It will give you the following URL:
https://xxx.ru/page/update-1/

How to use mod_rewrite to remove a part of a domain

I've this url:
example.com/de/type/villen/
It bothers me that my url contains the /type/. Is there an option to remove this string from my URL?
So someone goes to the URL /de/type/villen and NOT redirect to /de/villen/.
Only display in the browser /de/villen/.
Is that possible?
You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} /(de)/type/(villen)/ [NC]
RewriteRule ^ %1/%2 [R=302,L,NE]
RewriteRule ^(de)/(villen)/?$ $1/type/$2 [L,NC]
Try
RewriteEngine On
RewriteRule (.*)/type/(.*) /$1/$2 [L]

htaccess rewrite url parameter

I want to redirect
http://localhost:8080/mypproject/?supplier=test123
to
http://localhost:8080/myproject/?product_cat=test123
But I don't know how...
You can use this code in your /myproject/.htaccess file:
RewriteEngine On
RewriteBase /myproject/
RewriteCond %{QUERY_STRING} ^supplier=([^&]+) [NC]
RewriteRule ^/?$ ?product_cat=%1 [L,R=301]

How to rewrite these url on htaccess

i want to rewrite these URL
getimage.php?videoid=myquery
to
img/myquery
i try this ht access code but after this its show empty page
RewriteEngine On
RewriteBase /
RewriteRule ^img/(.+) getimage.php?videoid=$1
please tell me how to set it
You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} /getimage.php\?videoid=([^\s&]+) [NC]
RewriteRule ^ img/%1? [R=302,L,NE]
RewriteRule ^img/([^/.]+)/?$ getimage.php?videoid=$1 [L,QSA,NC]
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} videoid=(.+)
#RewriteRule getimage.php$ /img/%1? [R=301,L] #redirect
RewriteRule getimage.php$ test/%1? [L] #rewrite

How to do Url rewriting for folders?

I need to rewrite the link below
www.website.com/folder1/folder2/index.php?name=value
to be like this :
www.website.com/folder1/folder2/name/
I tried htaccess with this line of code, but it doesn't work.
RewriteEngine on
RewriteRule ^name/([A-Za-z0-9-]+)/?$ index.php?name=$1 [NC,L]
Thank you in advance!
Insert this rule in /folder1/folder2/.htaccess:
RewriteEngine On
RewriteBase /folder1/folder2/
RewriteCond %{THE_REQUEST} /index\.php\?name=([^\s&]+) [NC]
RewriteRule ^ name/%1? [R=302,L,NE]
RewriteRule ^name/([A-Za-z0-9-]+)/?$ index.php?name=$1 [NC,QSA,L]

Categories