Search code examples
.htaccessmod-rewritelitespeed

htaccess - how to get only domain name and one variable inside url


my remote server is LiteSpeed - not Appache
not sure is it the same regarding htaccess code

original url - example.com/index.php?c=kb

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home/(.*)$ /index.php?c=$1 [L]

plus - <base href="/">

result - example.com/home/kb - works fine

now I want to remove home - to get - example.com/kb

RewriteRule . /index.php [L]  

the page is there but css and js are missing
seems problem is with <base href="/">
any help?


Solution

  • to see - example.com/kb. On server - example.com/index.php?c=kb

    You may try this code for above scheme:

    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([\w-]+)/?$ index.php?c=$1 [L,QSA]
    

    References: