Wordpress remove the index.php in urls

Discussion in 'Install/Configuration' started by nullx8, Sep 21, 2017.

  1. nullx8

    nullx8 Active Member

    i have set up wordpress in a seperate context virtual host based .. as the installation is outise the directory ..
    everything works fine but i can not get the rewrite rules to work so i can drop the index.php inside the urls ..

    could anyone help me on that ?

    i have a context set up with
    • Accessible: Yes
    • Index Files: index.php
    • Auto Index: no
    • Enable Rewrite: Yes
    • Rewrite Inherit: no
    • Rewrite rules:
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ./index.php/$1 [QSA,L]
    i tried a few other ways to call index.php with a parameter .. but none of them actually worked ..
     
  2. NiteWave

    NiteWave Administrator

    the syntax looks wrong. how about
    RewriteRule (.*) ./index.php [QSA,L]
    ?
     
  3. nullx8

    nullx8 Active Member

    no that i tersted before .. the current setting is just to make it work with the index.php in the path

    if i use your suggestion and use a link with a Questionmark in it .. it works . but friendly names without a ? in it do not work for some reason
    i do then see the default page outside the context .. which is kind of strange (meaning instead of loading anything inside the context it loads the default page of the VH_ROOT
     
  4. Jon K

    Jon K Administrator Staff Member

    So you want WordPress to handle pages like example.com/2017/09/22/hello-world/ instead of example.com/index.php?253 ?

    If so make sure Permalinks are enabled in WordPress and try the following rules:

    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
     
  5. nullx8

    nullx8 Active Member

    hello and thanks for the suggestion
    wordpress is running in a subfolder deep inside the structure.
    so i created a context called /wblog
    the context has default document index.php
    rewrite enabled
    and Rewrite Inherit false
    the ruses are exactly the same as you suggested:
    Code:
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    since this is a context i would not need the directory to be mentioned

    however once i remove the /index.php/ from the permalink settings .. the wordpress root will be loaded just fine, but ALL links will take forever and then the root page will be loaded (welcome page)
    i attaching the context settings (which are VERY straigt forward)
    Screen Shot 2560-09-22 at 10.02.39 PM.png
     

Share This Page