I
I
ILoveYAnny2016-10-19 00:46:37
htaccess
ILoveYAnny, 2016-10-19 00:46:37

How to organize correct rewrite in .htaccess for Twig template?

Hello, I have Twig, I want to make dynamically filled pages of the site. The following thought occurred to me:
1 script.php: generating a list of products
2 script.php: generating a specific product
In htaccess I write:

RewriteRule ^продукты$ /pages/1скрипт.php [NC,L]
RewriteRule ^продукты/(.*)$ /pages/2скрипт.php?продукт=$1 [NC,L]

Everything is fine in the list of products, but when I switch to a specific product, all js scripts fly for me, under the error
Uncaught SyntaxError: Unexpected token <
Templates are identical.
I conducted experiments, if from xtaccess from this line
RewriteRule ^продукты/(.*)$ /pages/2скрипт.php?продукт=$1 [NC,L]

Remove /(.*), then everything is fine. But then I won't be able to tell the template which product to generate. In general, this is not an option.
If you do not render the Twig object, there is no error either :D I still think that there is a problem in htaccess. At first I thought that I thus prohibited the loading of js files and css, but then I realized that I thought stupidity .. Please help me, I'll never know ..

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question