Jump to content

[SOLVED] how to change all shop urls


fatheeym

Recommended Posts

i want some thing provide me to change all shop urls

for example the images urls is

myshop.com/modules/sliders/image.jpg Or myshop.com/imgs/image.jpg

i want to make it appear with another url i mean if the image url is myshop.com/modules/sliders/image.jpg appear to users like this myshop.com/image.jpg

---------------

or for example

the wishlist url is myshop.com/en/module/blockwishlist/view?token=3419B05B1B45fdsf

i want to the url to be like 

myshop.com/wishlist/view=6456454dsad4dsa

==============================================

 

in other way

all i want to remove the real Folders from urls

Folders like ( Modules - Imgs - etc..

thank you

Link to comment
Share on other sites

It's not possible to rewrite the URL myshop.com/en/module/blockwishlist/view?token=3419B05B1B45fdsf to myshop.com/wishlist/view=6456454dsad4dsa. The /en/ can only be removed if you have a single language, otherwise PrestaShop cannot know the currently selected language. Also, you cannot remove ?token= from the URL, since the token parameter will not be correctly created and the page will fail.

 

The best you could do is have myshop.com/en/wishlist/view?token=3419B05B1B45fdsf, but that would require modifying the wishlist block to implement the hookModuleRoutes function. For example, my Image/Video Gallery module is able to use the URL http://www.nethercottconstructions.com/en/gallery/nature by implementing the following function:

    public function hookModuleRoutes($params)
    {
        $context = Context::getContext();

        if (isset($context->employee)) {
            return array();
        }

        return array(
            'module-gallerync-gallery' => array(
                'controller' => 'gallery',
                'rule' => 'gallery/{gallery}',
                'keywords' => array(
                    'gallery' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'gallery')
                ),
                'params' => array(
                    'fc' => 'module',
                    'module' => 'gallerync'
                ),
            ),
            'module-gallerync-image' => array(
                'controller' => 'image',
                'rule' => 'gallery/{gallery}/{image}.html',
                'keywords' => array(
                    'gallery' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'gallery'),
                    'image' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'image'),
                ),
                'params' => array(
                    'fc' => 'module',
                    'module' => 'gallerync'
                ),
            ),
        );
    }

I think it's better to leave the URLs the way they are, but if you insist on changing them, you could modify PrestaShop's modules by adding code like above. Just be aware that it will be a lot of work and you'll lose the changes whenever you update your modules, unless you can override the modules using the override/modules directory.

Link to comment
Share on other sites

I don't think it's going to improve security much. It's pretty obvious from reading the source code of a website that it's a PrestaShop website and knowing that, it easy to know the structure of the website. It also won't stop a hacker adding a malicious query string at the end of your URL. I believe as long as you keep your PrestaShop at the latest stable version,  you have all your folders set to chmod 755 and files to chmod 644 and you have an .htaccess file and robots.txt to prevent access to files, you should have no problems with security.

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...