Problems removing query string from url in Prestashop - .htaccess

I've got a prestashop website using xpert blog module for blog posts. The problem is that all posts' urls end up with:
.html?page_type=post
I need to avoid or hide these query string via .htaccess. Can anybody help me out?

Please try this in your .htaccess:
RewriteEngine on
RewriteCond %{THE_REQUEST} \?page_type=post\sHTTP [NC]
RewriteRule ^ %{REQUEST_URI}? [L,R]

Related

Redirect .htaccess Using question mark Still not working

I want to redirect a specific page :
http://olddomain.com/index.php?p=70 to http://newdomain.com/newpage.php
i try to create .htaccess like this but still not working :
Redirect 301 /index.php?p=70 http://newdomain.com/newpage.php
Any help would be appreciated. Thanks
Try :
RewriteEngine on
RewriteCond %{THE_REQUEST} /index.php\?p=70\s [NC]
RewriteRule ^ http://example.com/newpage.php? [L,R]

HTACCESS: Do a url rewrite

I'm trying to use htaccess to do a url rewrite.
I would like the people to access the site in the browser using this:
http://exmaple.com/ladada
But the files are inside a subdomain:
http://ladada.exmaple.com
Would that be possible? People will access the site using the first link but in the backend it's being rewritten to the second link? Thank you so much!
mod_rewrite doc should help you.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ladada\.example\.com [NC]
RewriteRule (.*) http://example.com/ladada/$1 [L,R=301]

htaccess rewrite part of url

Been trying to figure this one out - also found similar examples here on stack overflow, but can't get it to work.
I'm trying to rewrite a URL from
http://www.domain.com/index.php?option=com_users&view=login&return=aHR0cDovL3d3dy5vc
to:
http://www.domain.com/login&return=aHR0cDovL3d3dy5vc
I've tried this:
RewriteRule ^/?index.php?option=com_users&view=login&return(.*)$ /login?return$1 [R=301,L]
But as I said, can't get it to work, so appreciate any help.
Thanks!
You can use this rule as first rule in your .htaccess:
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php\?option=com_users&view=([^&\s]+)&return=([^&\s]+)
RewriteRule ^ /%1?return=%2 [R=301,L]
You cannot match QUERY_STRING using RewriteRule.

Redirect this dynamic URL to html URL with htaccess

I have lot or articles with this URL format:
mydomain/art/details.php?articleid=24463&parentid=1&catid=166
the above is an example.
And i want that redirect these kind of URL to :
mydomain/art/24463.html
Please let me know that how can i do it with .htaccess?
Thanks in advance
Instead of mydomain/art/24463.html you should choose something like mydomain/art-166/1-24463.html.
This way, you'll include also parentid and catid which are dynamic parameters (and so, needed for rewriting).
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/art/details\.php\?articleid=(\d+)&parentid=(\d+)&catid=(\d+)\s [NC]
RewriteRule ^ /art-%3/%2-%1.html? [R=301,L]
RewriteRule ^art-(\d+)/(\d+)-(\d+)\.html$ /art/details.php?articleid=$3&parentid=$2&catid=$1 [L]
Try this in htaccess tester
RewriteEngine on
RewriteRule ^art/(\d+).html$ art/details.php?articleid=$1&parentid=1&catid=166 [nc]

301 redirect .HTACCESS - Remove Query String

I have a 404 page being found by analytics. I'm having trouble figuring out the correct syntax for redirecting the link below via .htaccess. Can anyone offer a solution? Thank you very much.
http://www.mywebsite.com/product-categories?format=feed&type=atom
I tried this and plenty of others without success.
RewriteCond %{QUERY_STRING} ^format=feed&type=atom$
RewriteRule ^product-categories/$ http://www.mywebsite.com/product-categories/? [L,R=301]
You have condition reverse in your RewriteRule. Use this rule:
RewriteCond %{QUERY_STRING} ^format=feed&type=atom$ [NC]
RewriteRule ^product-categories/?$ /product-categories/? [NC,NE,L,R=301]

Resources