WordPress.org

Ready to get started?Download WordPress

Forums

HTACCESS causes problem (3 posts)

  1. thinktanks
    Member
    Posted 7 months ago #

    When I removed this HTACCESS file below out of the WP core file directory or having none at all, the theme styles and functions seem to work properly but cannot get access to any other pages only displaying the front page. The new HTACCESS is automatically generated on every deleting not long ago after the previous deletion which brings back a normal access to all the pages BUT the theme style and functions are breaking instead. I have zero knowledge in the command/code within HTACCESS, please guide what it seems to be the problems with my HTACCESS below which have caused such problems and what's your recommendation?

    # Block the include-only files.
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    
    # protect from sql injection
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    RewriteRule ^(.*)$ index.php [F,L]
    
    #disable hotlinking of images with forbidden or custom image option
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.local/.*$ [NC]
    #RewriteRule \.(gif|jpg)$ – [F]
    RewriteRule \.(gif|jpg)$ http://www.domain.local/stealingisbad.gif [R,L]
    
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
    RewriteCond %{HTTP_REFERER} !.*domain.local.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
    
    # disable directory browsing
    Options All -Indexes
    
    # STRONG HTACCESS PROTECTION</code>
    <Files ~ “^.*\.([Hh][Tt][Aa])”>
    order allow,deny
    deny from all
    satisfy all
    </Files>
    
    # Protect the .htaccess
    <files .htaccess="">
    order allow,deny
    deny from all
    </files>
    
    # protect wpconfig.php
    <Files wp-config.php>
    order allow,deny
    deny from all
    </Files>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteRule ^(index\.php|wp-content/repair\.php|wp-comments-post\.php|wp-includes/js/tinymce/wp-tinymce\.php|wp-login\.php|index\.php|wp-admin/)(.*) $1$2 [QSA,L]
    RewriteRule ^(.*)\.php$ /nothing_404_404 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  2. leejosepho
    Member
    Posted 7 months ago #

    Do you know the source of that code? That appears to be coming from a security plugin, and the WordPress-generated code for your permalinks appears to be missing altogether. So, try going to Dashboard > Settings > Permalinks and having WordPress try to add that code.

  3. Tom Leger
    Member
    Posted 7 months ago #

    You'll need an .htaccess file on your server that includes the code mentioned in the codex. This is what is preventing you from seeing the order pages on your site.

Reply

You must log in to post.

About this Topic

Tags