skip to Main Content

I checked many other similar questions but I can’t come up with a .htaccess rule that would work properly.

I have a server containing a Knowledgebase system (knowledgebase.php). I don’t want to show this knowledgebase.php in the URL, ever.

Examples what I want:

How can I do this?

I tried many options, including this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /knowledgebase.php?/$1 [L]

2

Answers


  1. Could you please try following, written based on your shown samples. Please clear your browser cache before testing urls.

    RewriteEngine ON
    RewriteCond %{REQUEST_URI} ^/?$
    RewritewriteRule ^ knowledgebase.php [L]
    
    RewriteCond %{REQUEST_URI} ^/(knowledgebase) [NC]
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^(.*)$ http://%{HTTP_HOST}/?article=1 [L]
    
    Login or Signup to reply.
  2. You can use this :

    RewriteEngine on
    #1) redirect "help.thecrypto.app/" to /knowledgebase.php
    RewriteCond %{HTTP_HOST} ^help.thecrypto.app$ [NC]
    RewriteRule ^knowledgebase.php$ / [L,R]
    #2) internally map knowledgebase.php to the root /
     RewriteRule ^/?$ /knowledgebase.php [END]
    

    This will serve /knowledgebase.php if you visit your site hompage / .

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search