Jump to content

.htaccess help


guest*

Recommended Posts

I commented out the product id's, category_id's, the EAN and also the .html at links.php to get the same friendly URLS we have now on the old project which is migrating to presta. We use only one language, so it should be no problem doing this.

I adapted it by this way as example:

        if (is_object($id_category))
           return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__/*.intval($id_category->id).'-'*/.$id_category->link_rewrite) :
           (_PS_BASE_URL_.__PS_BASE_URI__.'category.php?id_category='.intval($id_category->id));
       if ($alias)
           return ($this->allow == 1) ? (_PS_BASE_URL_.__PS_BASE_URI__/*.intval($id_category).'-'*/.$alias) :




Now my links are:

my domain/product
my domain/category
my domain/content-title

When I go with mouse over the links are all like named, but I cannot klick anything without getting a 404. So I think I need to adapt also .htaccess. Can somebody please help me ?

Original presta is:

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]
RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [L,E]
RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]
RewriteRule ^blog/$ //modules/blocknews/news.php [QSA,L,E]
RewriteRule ^blog/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ //modules/blocknews/news.php?id_entry=$1 [QSA,L,E]

# Catch 404 errors



How should I adapt this, to match my friendly-URLS ? We also would pay for it, if it is too much work to adapt the .htaccess.

Link to comment
Share on other sites

Just for your reference. (Maybe you already know all this)
You don't have to change any code to get the SEO friendly URL links. You can enable it at PrestaShop
Back Office - Preferences Tab - set "Friendly URL" to yes

You can also generated the .htaccess file automatically at above same page.

But IIS does not support UrlRewrite by default. You need to install some UrlRewrite tools. I didn't try it myself, but there is some discussion and information here.

http://serverfault.com/questions/30001/php-url-rewriting-with-htaccess-and-microsoft-iis-url-rewriting

Link to comment
Share on other sites

äh ??? Yes I wrote there, that I changed my friendly URL's, because I want it to be conform to the project which is still online and I'm migrating to presta. So the friendly links must be edited once more to fit.

Yes I know that IIS does not support .htaccess, but it supports a web.config. So I need an adapted .htaccess to can create a proper web.config. Web.config was working still I changed the friendly URL's into my again cutted URL's.

Can please somebody help me to adapt the .htaccess for my new URL's ? I will pay also for it some euros if work is difficult and intensive. I cannot do it by myself, because I'm not a coder and also do not understand the rewirte codes.

Link to comment
Share on other sites

You can't just remove the IDs from the friendly URLs and expect it to work. How is PrestaShop supposed to know which product to redirect to? The only way to remove the IDs from products is to create a separate rewrite rule for each product, which quickly becomes unmanagement if you have many products. It is easiest just to leave the product ID in the URL. It doesn't hurt SEO to leave it there.

  • Like 1
Link to comment
Share on other sites

oh... Yes you are right: for SEO it's not a problem if you have a new project without any same project before. But when I go by this way you poropse, than I will loose PR and all positions of my old project which I'm moving into presta. SERPS will penalize me for DC because old and new content are the same, but URL's not.

There are 16.000 products and about hundred of categories I'm moving into presta.

Which is the best way to don't loose all, i.e. not get DC ? Old project has no rel=canonical. Would it better to let google delete all the old links before moving ?

Old Shop was on root, will it bring me something, if I move presta into a folder like /shop and make a permanent redirection into /shop. Will I loose here something ?

The only thing what I dont want is the module /blog than as /shop/blog, because I have already a blog at /blog and here I'm migrating all my posts to let the same link. So I must adapt this one. Ist is possible because the blog does not form the links with id's ?

I really don't know why presta works by this way, it it is possible to have shorter links without any ID in it, like my actual software do. For me is more freindly if I have a link like

my domain/product

as a link mydomain/123-product.html, though for SERPS it does not has any influence. For human it is. Human will not remember an id, but a clear name...
Perhaps presta can do this better in futrue ???

  • Like 1
Link to comment
Share on other sites

In my case, would it better to have presta in a folder like /shop to not loose links in SERPS and others setted ? So I can make a general rewrite and let SERPS discard all old Links they don't found by getting the new ones ?
Actual project is in root and I really don't know how to manage 16.000 products and it re-dicrects if it is not possible to shortage links in order to be compatible.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...