Enter your keyword

.htaccess

How to Change Admin URL Without Plugin

Step 1: Configuration define in wp-config.php

define('WP_ADMIN_DIR', 'private-area');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR); 

Step 2: Add a function in your theme functions.php file

add_filter('site_url',  'change_wpadmin_url', 10, 3);  
function change_wpadmin_url( $url, $path, $orig_scheme ) {
	$old_admin_url  = array( "/(wp-admin)/");
	$admin_dir = WP_ADMIN_DIR;
	$new_admin_url  = array($admin_dir);
	return preg_replace( $old_admin_url, $new_admin_url, $url, 1); 
}

Step 3: Add a line to .htaccess file

RewriteRule ^private-area/(.*) wp-admin/$1?%{QUERY_STRING} [L]

New htaccess Code for WordPress Permalinks

For Root Directory

# BEGIN WordPress  
<IfModule mod_rewrite.c>  
RewriteEngine On
RewriteBase /  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule . /index.php [L]  
</IfModule>  
# END WordPress

For Subdirectory

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

How to Compression of js and css in using .htaccess

Add this code to your .htaccess file

RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*).js$ $1.js.jgz [L]
AddType "text/javascript" .js.jgz
AddEncoding gzip .jgz

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*).css$ $1.css.jgz [L]
AddType "text/css" .css.jgz
AddEncoding gzip .jgz
Options -Indexes