Wordpress Rewrite Rules.

Discussion in 'General OpenLiteSpeed Discussion' started by Ahmed Mafaz, Jan 30, 2018.

  1. Ahmed Mafaz

    Ahmed Mafaz New Member

    Hello,
    I have wordpress1 installed to domain.com
    When i setup wordpress2 to domain.com/en/ all links keeps redirecting to domain.com

    For wordpress2 i created virtual host:
    Document root: /home/username/public_html/en
    Domain name: domain.com
    Domain alias: en.domain.com

    With the rewrite rule:

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /en/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /en/index.php [L]
    </IfModule>
    
    # END WordPress
    Is the rewrite rule correct?
    Thanks.
     
  2. Tishu

    Tishu Member

    Hello,

    Remove "en" part in the rewrite rules.
     
  3. Ahmed Mafaz

    Ahmed Mafaz New Member

    It still redirects to links from domain.com

    Code:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
     
  4. Tishu

    Tishu Member

    Hello again,

    I see that domain name for en.domain.com is only domain.com. Can you tell what is the end point of this 2 pages. Are they the same or they are different.
     
  5. Ahmed Mafaz

    Ahmed Mafaz New Member

    1 domain 2 wordpress installations.

    wordpress1 to domain.com
    wordpress2 to domain.com/en/
     
  6. Tishu

    Tishu Member

    Is the content different or its only the lang different?
     
  7. Ahmed Mafaz

    Ahmed Mafaz New Member

    Only the language.
     
  8. andrewklimek

    andrewklimek New Member

    Litespeed doesn't support rewriteBase...

    You can make a Litespeed "Context" to do the same thing, putting the URL prefix in the Context's URI and Location settings.

    Or maybe something like this
    RewriteRule ^/en/index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule /en /en/index.php [L]
     
  9. Tishu

    Tishu Member

    Hello,

    Yes, from the virtual host tab use Context menu.
     
  10. Ahmed Mafaz

    Ahmed Mafaz New Member

    I dont understand.
    How do i setup the context?


    Using this:
    Code:
    RewriteRule ^/en/index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule /en /en/index.php [L]
    
    in the rewrite tab does not work still.
    Everything works fine apache.
     
  11. Ahmed Mafaz

    Ahmed Mafaz New Member

    Update:
    I think ive managed to do what @andrewklimek mentioned althought it does not work too.
    Could you check whether ive done it correctly? Thanks.

    [​IMG]
     

Share This Page