Prestashop products url ends .html - .htaccess

In Prestashop I using SEO & URL and in settings on the "route to products" looks like this: {id}-{rewrite}.html and my url looks like:
www.example/12-product1.html
And if i delete from "route to products" .html my url open like this:
www.example/12-product1
But now the site not found. How I understand, now I need to change the URL without .html end in database?

If you delete the .html of the product rewrite rule it will conflict with the default category rewrite. To avoid this, change the category rewrite, maybe adding another - between id and the name.

Related

htaccess - redirect rule on directory

My site currently contains URL's like so:
mysite.com/accessories/bags
mysite.com/clothes/dresses
mysite.com/clothes/dresses/maxi
mysite.com/clothes/dresses/maxi/products
mysite.com/clothes/skirts
mysite.com/clothes/tops
mysite.com/clothes/tops/party
mysite.com/shoes
I now need to redirect any URL's that contain the clothes directory to another domain but keep the same structure.
Is there a rewrite rule where I can do something along the lines of:
mysite.com/clothes/* => newsite.com/clothes/*
i.e
mysite.com/clothes/dresses => newsite.com/clothes/dresses
mysite.com/clothes/dresses/maxi/products => newsite.com/clothes/dresses/maxi/products
And work for however many subfolders within clothes
I had been doing
redirect 301 /clothes/dresses https://www.newsite.com/clothes/dresses
But there are approx 2000 URL's with this instance so one rul to cover all would be good if possible
You can do this by using a simple Redirect directive
Redirect 301 /clothes/ https://www.example.com/clothes/
This will not just redirect /clothes/ but also /clothes/foobar to https://www.example.com/clothes/foobar .

How to display post name right after domain through .htaccess

I have listed post form page articles which currently looks like this:
http://demo.web/articles/hello-world
and I just want to display url which will look something like this: http://demo.web/hello-world
but the problem is the page articles will fetch the data with the id passed in the URL.
And, I have also listed other article on the same page with the title other posts. I am already inside http://demo.web/articles/hello-world and if I hover over other links of the same page then it gives url which looks like this:
http://demo.web/articles/2/hello-world/articles/3/life-is-beautiful
What I mean to say is the URL is being appended in the existing URL.
At the end what I want my url to look like this: http://demo.web/hello-world or http://demo.web/life-is-beautiful
My .htaccess file have the following code:
RewriteEngine On
RewriteRule ^([a-zA-Z]+)$ $1.php
RewriteRule ^articles/([0-9]+)/([a-z-]+) articles.php?id=$1&act=$2
Its like you are rewriting as a relative path.
Try adding / in front "articles.php?id=$1&act=$2"

How to erase part of the link using .htaccess

i change the permalink of wordpress with the rule "/%postname%/" and it's working perfectly.
The only problem i use wp-commerce and for some reason generate the permalink to the product with this in the end "&negozio=NEGOZIO" and so give for every product i want to see a 404 page.
I know with .htaccess you can rewrite urls so i'm asking what's the correct rule for make a link like this :
http://www.ctssolutions.it/products-page/gestione-banconote/bj-140/&negozio=NEGOZIO
became something like this :
http://www.ctssolutions.it/products-page/gestione-banconote/bj-140/
Thank in advance

htaccess remove part of the url

I have urls structured like this:
/!#/pretty-url/
I need to remove the !# so the urls will look like this:
/pretty-url/
What would be the correct .htaccess rule to do this?
When you have a # in the URL then that is a named anchor. The browser does not send anything to the right of a # to the server. This means that all the rewrite engine is seeing is:-
/!
If you want your URLs to look like this then you are going to need to use JavaScript to get the relevant content via AJAX.

.htaccess redirect question

I have a slight problem with .htaccess redirect.
I have a dynamic site with 2 levels of variables - content="type -(alpha)" and ID="number" but this is very not seo friendly what I really would like to create is a rewrite rule that generates a "friendly" url for serach engines & users alike. Very much like WordPress does.
Each ID is already unique (obviously) and on creation is creating a unique "permalink" field so for example ID=1 has a "permalink field" as "2009/10/27/page title" and ID=100 would be "2010/10/27 page title".
I would like folder/wall.php?content=type&ID=number to redirect to folder/permalink.php/html/htm (don't mind a non dynamic extension)
Any clues? - this is not right (I know) but it also "breaks" my css file
RewriteEngine On
RewriteRule wall/content/(.*)/ID/(.*)/ wall.php?content=$1&ID=$2
RewriteRule wall/content/(.*)/ID/(.*) wall.php?content=$1&ID=$2
You need to make sure you have a URL convention that won't conflict with other files on the server. For example, if your page is displaying "Products" and you don't have an actual folder in the root of your server called /products/, you could do this
RewriteEngine On
RewriteRule ^products/([^/\.]+)/([^/\.]+)/?$ wall.php?content=$1&id=$2 [L,NC,QSA]
Replace "products" in this example with whatever name is most appropriate for what your wall.php page does.
This would equate to the following URL
www.yoursite.com/products/title/29/
Which would rewrite to
www.yoursite.com/wall.php?content=title&id=29

Resources