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]
Related
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/
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]
I have an URL as :
http://mydomain.com/site/?cmd=home
I want to change the above address to http://mydomain.com/home
i am using .htaccess file like this:
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ /site?cmd=$1 [L]
I am not sure where is the problem?
Thanks in advance
The Rule works the other way around: you want to get from /site/?cmd=home to /home, but with your RewriteRule you are redirecting to /site?cmd= (Probably there is a mistake somewhere?)
If you want to redirect from /site/?cmd=home to /home, like the question states, use the following:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/site
RewriteCond %{QUERY_STRING} ^cmd=(.*)$
RewriteRule ^(.*)$ /%1/? [R=302,L]
You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteCond %{THE_REQUEST} /site\?cmd=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L]
# internal forward from pretty URL to actual one
RewriteRule ^([^/.]+)/?$ /site?cmd=$1 [L]
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/
Firstly,Thanks for reading this. How to rewrite the url , in htaccess
For example
wwww.domain.com/home?name=MuhdNazmi <---OLD URL
wwww.domain.com/home/MuhdNazmi <---NEW URL
name is a get variables,
I dont need put .php , since it code for not showing > .php
Try:
RewriteCond %{THE_REQUEST} \ /home\?name=([^&\ ]+)
RewriteRule ^ /home/%1? [L,R=301]
RewriteRule ^home/([^/]+)$ /home?name=$1 [L,QSA]
RewriteEngine On
RewriteRule ^home/([^/]*).php$ /home?name=$1 [L]
If it is a one on redirect then you can follow the below example for you redirect
RewriteEngine on
RewriteCond %{QUERY_STRING} name=MuhdNazmi$ [NC]
RewriteRule ^home/$ /home/MuhdNazmi? [L]
If you want to define it as a generic rule for all the query string parameter modify the above code as
RewriteEngine on
RewriteCond %{QUERY_STRING} name=(.*)$ [NC]
RewriteRule ^home/$ /home/%1? [L]