i'm looking for a htaccess rule that can do this:
Original URL: ?til=main
Replace to: /main
and if this is the scenario:
Original URL: /index.php?til=main
or ?til=main
Redirect to: /main
Till now i only have this code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?til=$1 [L,QSA]
It loads /main
but behind it loads /index.php?til=main
This should work:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /\?til=(.*)\ HTTP [OR]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?til=(.*)\ HTTP
RewriteRule ^ /%2? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?til=$1 [L]
It should redirect index.php?til=main
and ?til=main
to /main
Try:
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /+(?:index\.php|)\?til=([^&\ ]+)
RewriteRule ^ /%1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?til=$1 [L,QSA]