Answer the question
In order to leave comments, you need to log in
How to solve the problem with redirects in Mod_Rewrite?
Good afternoon, dear =)
Let me get straight to the point: I have a folder with all the modules in the root of the site, for example, /content/.
Each folder (forum, blogs, games, etc.) contains everything necessary for the module to work (files, templates, handlers, classes, styles, etc.). And of course there are beautiful links, for example:
site.ru/forum/theme543
site.ru/blogs/post543
Until today, I specified the path to each file in each module in the root .htaccess:
# включаем mod_rewrite
RewriteEngine On
RewriteBase /content/
# форум
RewriteRule ^forum/theme([0-9]*)$ forum/theme_view.php?id=$1 [L,NC,QSA]
и еще 24 ссылки
# блоги
здесь около 15
# игры
здесь n-количество ссылок
# включаем mod_rewrite
RewriteEngine On
RewriteBase /content/
RewriteRule ^forum/theme([0-9]*)$ forum/ [L,NC,QSA]
# включаем mod_rewrite
RewriteEngine On
RewriteBase /
RewriteRule ^forum/theme([0-9]*)$ theme_view.php?id=$1 [L,NC,QSA]
Answer the question
In order to leave comments, you need to log in
well, for this you need to do the following...
Nothing!
.htaccess is how it works.
All you have to do is create a .htaccess file inside the folder you need.
Also, it would not be sour to bring the entire .htaccess because it’s not clear.
As for the number of lines, I have an average of about 6K lines per store and I measured nifiga does not slow down.
As for optimization, let's think about the whole file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question