• Resolved lwunder145

    (@lwunder145)


    Hello there!

    I’ve been trying to figure out how to get “pretty links” to work on my local development machine. I keep receiving Apache’s 403 error page whenever I try to access the site.

    I am using Apache 2.4.7 (x64) with PHP configured through mod_fastcgi 2.3.9 (also x64); all built for Windows machines.

    I have direct access to all of Apache’s server configuration files. I use VirtualHosts, along with hacks to my hosts file ( to fake DNS registrations on my machine ) to work with multiple sites at the same time. Below is the current configuration for my particular WordPress Installation.

    [ Excrept ]…

    <VirtualHost 127.0.0.1:80>
        ServerAdmin [email protected]
        DocumentRoot "C:/rel/httpd/docs/wordpress.test"
        ServerName wordpress.test
        ServerAlias www.wordpress.test
        ErrorLog "logs/wordpress.test-error.log"
        CustomLog "logs/wordpress.test-access.log" common
    
    	<Directory "C:/rel/httpd/docs/wordpress.test">
    		Options FollowSymLinks
    		AllowOverride All
    		Require all granted
    	</Directory>
    
    	<IfModule dir_module>
    		DirectoryIndex index.php
    	</IfModule>
    </VirtualHost>

    The .htaccess file WordPress generates is writable; here is it’s current configuration:

    # 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>
    
    # END WordPress

    If you need any additional information; let me know! I’ve been going crazy over how to set this up correctly!

Viewing 5 replies - 1 through 5 (of 5 total)
  • 403 is an access denied error. Usually ownership or permissions related.
    General Reference: https://en.wikipedia.org/wiki/HTTP_403

    I’ve been trying to figure out how to get “pretty links” to work on my local development machine.

    You didn’t mention mod_rewrite, so I will… It’s installed and functioning? Some reference material: Using Permalinks

    Thread Starter lwunder145

    (@lwunder145)

    I do have mod_rewrite un-commented through the httpd.conf file ( see below ):

    [ Excrept ]:

    #LoadModule reflector_module modules/mod_reflector.so
    #LoadModule remoteip_module modules/mod_remoteip.so
    #LoadModule request_module modules/mod_request.so
    #LoadModule reqtimeout_module modules/mod_reqtimeout.so
    LoadModule rewrite_module modules/mod_rewrite.so
    #LoadModule sed_module modules/mod_sed.so
    #LoadModule session_module modules/mod_session.so
    #LoadModule session_cookie_module modules/mod_session_cookie.so

    I’ve looked into the access logs for any clues and found this particular message for every 403 error encountered:

    [Tue Feb 11 10:42:45.823002 2014]
    [rewrite:error]
    [pid 3184:tid 916]
    [client 127.0.0.1:61127] AH00670:
    Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions :
    C:/rel/httpd/docs/wordpress.test/index.php

    Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden

    That might be telling you where you could start troubleshooting.

    You can try placing this at the very top of your .htaccess file and see if it helps. Or if it at least changes the error message.

    Options +FollowSymlinks

    There might also be more info that could help if you go back and take a look at Using “Pretty” permalinks

    Thread Starter lwunder145

    (@lwunder145)

    Changing the httpd-vhosts.conf file to below:

    <VirtualHost 127.0.0.1:80>
        ServerAdmin [email protected]
        DocumentRoot "C:/rel/httpd/docs/wordpress.test"
        ServerName wordpress.test
        ServerAlias www.wordpress.test
        ErrorLog "logs/wordpress.test-error.log"
        CustomLog "logs/wordpress.test-access.log" common
    
    	<Directory "C:/rel/httpd/docs/wordpress.test">
    		AllowOverride All
    		Require all granted
    	</Directory>
    
    	<IfModule dir_module>
    		DirectoryIndex index.php
    	</IfModule>
    </VirtualHost>

    …and the .htaccess file to below:

    Options +FollowSymLinks
    
    # 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>
    
    # END WordPress

    This still results in an error 403.

    I don’t think it would be an issue with permissions, since Apache is running as a service in Windows through a local system account.

    What is interesting is three successive 403’s that are very close in time to eachother:

    [Wed Feb 12 22:38:08.146163 2014] [rewrite:error] [pid 2832:tid 932] [client 127.0.0.1:51332] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : C:/rel/httpd/docs/wordpress.test/index.php
    [Wed Feb 12 22:38:08.310224 2014] [rewrite:error] [pid 2832:tid 932] [client 127.0.0.1:51332] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : C:/rel/httpd/docs/wordpress.test/index.php
    [Wed Feb 12 22:38:08.334784 2014] [rewrite:error] [pid 2832:tid 932] [client 127.0.0.1:51332] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : C:/rel/httpd/docs/wordpress.test/index.php
    Thread Starter lwunder145

    (@lwunder145)

    Ok, I found the solution.

    Recall that:

    I am using Apache 2.4.7 (x64) with PHP configured through mod_fastcgi 2.3.9 (also x64); all built for Windows machines.

    The key phrase here was “with PHP configured through mod_fastcgi 2.3.9”.

    The original configuration on how the web server handled .php files is below:

    #
    # Loads the parameters for the Fast CGI Module
    # This module interfaces with PHP
    #
    <IfModule fcgid_module>
        FcgidInitialEnv PATH "C:/rel/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
        FcgidInitialEnv SystemRoot "C:/Windows"
        FcgidInitialEnv SystemDrive "C:"
        FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
        FcgidInitialEnv TMP "C:/WINDOWS/Temp"
        FcgidInitialEnv windir "C:/WINDOWS"
        FcgidIOTimeout 360
        FcgidIdleTimeout 600
        FcgidConnectTimeout 16
        FcgidMaxRequestsPerProcess 1000
        FcgidMaxProcesses 50
        FcgidMaxRequestLen 8131072
        # Location php.ini:
        FcgidInitialEnv PHPRC "C:/rel/php"
        FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
    </IfModule>
    
    #
    # Ensures that only files ending in the .php extension are processed
    #
    <Files ~ "\.php$>"
      AddHandler fcgid-script .php
      FcgidWrapper "C:/rel/php/php-cgi.exe" .php
      Options ExecCGI
      Require all granted
    </Files>

    Note that the files directive for Apache applies configuration options only to specific files matching whatever is specified above; in this case, PHP files. Also, note the absence of FollowSymLinksin the Optionsdirective…

    Once FollowSymLinkswas added, everything just worked!

    Now, make sure that you do allow Apache to access and tell Apache to read the .htaccess file in WordPress’ root directory, or else any changes WordPress makes to that file will be ignored.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress 3.8.1 – Permalink Troubles’ is closed to new replies.