Answer the question
In order to leave comments, you need to log in
How to write mod_rewrite rules?
There is a mini-site (8 pages) on site.com
All files (index.php, products.php, etc.) are in the root directory.
The phpbbex forum is also installed in the site.com/forum folder
Tasks:
1. Get to site.com/support.php from site.com/support ( implemented in Rule1 )
2. Redirect to site from site.com/products . com/products / , and land on site.com/products.php .
3. From the address site.com/products/products to get to site.com/products1.php (like implemented inRule2 , but Google Analytics writes 2 different links in the reports: /products/product1 and /products/product1 / depending on which url to go to, and I want only /products/product1 to remain.
4. From the address site.com/products/product1 / redirect to site.com/products/product1, and get to step 3
5. To open the forum at site.com/forum
My .htaccess:
Options FollowSymLinks
RewriteEngine On
RewriteBase /
ErrorDocument 404 /404.php
RewriteRule ^([a-z\-]+)$ $1.php #Правило1
RewriteRule ^products/([a-z\-]+)/?$ /$1.php [L] #Правило2
Answer the question
In order to leave comments, you need to log in
http://www.generateit.net/mod-rewrite/
http://beget.ru/art_mod_rewrite
http://habrahabr.ru/company/sprinthost/blog/129560/
At least we tried to figure it out ourselves before asking baby question? There are millions of examples and online generators of such rules on the Internet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question