Jump to content

How to keep Customized Part in htaccess file ?


patrmich

Recommended Posts

Hello,

I am using Prestashop 1.5.6.2.

I customized the htaccess file by adding some rules as follows :

# ~~Customized Part~~
RewriteEngine on
RewriteCond %{QUERY_STRING} ^one-specific-string.*$
RewriteRule ^(.*)$ /$1? [R=301,L]

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forumsI customize

# ~~Standard Part~~
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on
.../...

 

But, when I do the here below action, the htaccess file is automatically regenerated and the Customized Part is deleted :
Admin > Advanced parameters > Performances >
- Compile every time
- Cache to No
- Delete Smarty cache

Would you know how to avoid the deleting of the Customized Part of the htaccess file ?

I thank you in advance for any reply.

Patrick

 

 

Link to comment
Share on other sites

Hi,

I think you can achieve the same by editing the core file. 

Edit the classes/Tools.php & search for generateHtaccess function. 

In this function, you will find the lines like

fwrite($write_fd, "# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again\n");

 

You need to use the same code to add own lines in the .hatcess file.

Hope it will help.

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