I am running a website that's not on Wordpress, it is built by another developer using custom framework and it is too terrible. That's what make me crazy now.
Currently, I need to rewrite the request of users to our site as follow:
I tried many things without luck. %{SERVER_PORT} 80 is one of the things I've tried.
Below is my .htaccess's content:
Options +FollowSymlinks
DirectoryIndex home.html index.php
Options -Indexes
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 [OR]
RewriteCond %{HTTP_HOST} ^www.dongduong.edu\.vn [OR,NC]
RewriteRule ^(.*) https://dongduong.edu.vn/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+).html&vcb=([a-zA-Z0-9_-]*)&key_oder=([a-zA-Z0-9_-]*)$ index.php?com=$1&vcb=$2&key_order=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&noidi=([a-zA-Z0-9_-]*)&noiden=([a-zA-Z0-9_-]*)&date=([a-zA-Z0-9_-]*)&gia=([a-zA-Z0-9_-]*)$ index.php?com=$1&noidi=$2&noiden=$3&date=$4&gia=$5 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&diadiem=([a-zA-Z0-9_-]*)&sao=([a-zA-Z0-9_-]*)&gia=([a-zA-Z0-9_-]*)$ index.php?com=$1&diadiem=$2&sao=$3&gia=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&p=([0-9]+)$ index.php?com=$1&p=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&curPage=([0-9]+)$ index.php?com=$1&curPage=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&p1=([0-9]+)$ index.php?com=$1&p1=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&p=([0-9]+)&p1=([0-9]+)$ index.php?com=$1&p=$2&p1=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?com=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)&p=([0-9]+)$ index.php?com=$1&idc=$2&p=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+).html&sapxep=([a-zA-Z0-9_-]+)$ index.php?com=$1&sapxep=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)&sapxep=([a-zA-Z0-9_-]+)$ index.php?com=$1&idc=$2&sapxep=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html&sapxep=([a-zA-Z0-9_-]+)$ index.php?com=$1&idl=$4&idc=$2&sapxep=$5 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html$ index.php?com=$1&id=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+)_([a-zA-Z0-9_-]+).html$ index.php?com=$1&id=$3&idh=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ index.php?com=$1&idhai=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html&p=([0-9]+)$ index.php?com=$1&id=$3&p=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?com=$1&idc=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)/([0-9]+)$ index.php?com=$1&idi=$2&idi=$3&idi=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)/([0-9]+).html$ index.php?com=$1&idl=$2&idl=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html$ index.php?com=$1&id=$4 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html&p=([0-9]+)$ index.php?com=$1&idl=$4&p=$5&idc=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html$ index.php?com=$1&idl=$4&idc=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html$ index.php?com=$1&idc=$2&id=$5 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html&p=([0-9]+)$ index.php?com=$1&idi=$5&p=$6 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html$ index.php?com=$1&idi=$5 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html$ index.php?com=$1&idc=$2&id=$6 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html&p=([0-9]+)$ index.php?com=$1&idh=$6&p=$7 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+).html$ index.php?com=$1&idh=$6 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)_([0-9]+).html$ index.php?com=$1&idc=$2&id=$7 [L]
Please help me achieve this.
Thanks for your help!
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]