10/10/2018, 11:07
đau đầu vì htaccess
mình có file htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
vì trang mình còn có thêm cả phân trang nữa nên
bây h mình muốn thêm &page=$3 ở cuối thì làm ntnao? mình đã thử làm là
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/page-(.*)/? /index.php?option=$1&p=$2&page=$3 [L]
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
nhưng nó không chạy ai giúp mình với!
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
vì trang mình còn có thêm cả phân trang nữa nên
bây h mình muốn thêm &page=$3 ở cuối thì làm ntnao? mình đã thử làm là
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/page-(.*)/? /index.php?option=$1&p=$2&page=$3 [L]
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
nhưng nó không chạy ai giúp mình với!
Bài liên quan
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/page-(.*)/?$ /index.php?option=$1&p=$2&page=$3 [L]
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
[=========> Bổ sung bài viết <=========]
Không được thì thử thêm cách này:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/page-([0-9]+)/?$ /index.php?option=$1&p=$2&page=$3 [L]
RewriteRule ^(.*)/(.*)/? /index.php?option=$1&p=$2 [L]
</IfModule>
[=========> Bổ sung bài viết <=========]
huhu không ai giúp mình a hjxhjx
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^.*$ - [L]
RewriteRule ^(.*).html$ index.php?params=$1 [L]
Khi bạn bắt biến thì bắt 1 biến duy nhất là biến "params" , nó có dạng a/b/c/d/... , tách biến đó thông qua dấu "/" (tách thế nào thì tùy các bạn ).
a/b/c/d/ <=> option=$1&p=$2&page=$3 [L] =>option=a;p=b;page=c;... :d .
Chúc bạn thành công .
Bạn này chuẩn đấy.
Thử coi!