Category

.htaccess

Category

Http to Https in laravel Move .htaccess file from public folder to root directory and Rename server.php to index.php <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> Options +FollowSymLinks RewriteEngine On RewriteBase / # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder… RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller… RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php…

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteRule ^wp-admin/includes/ – [F,L] RewriteRule !^wp-includes/ – [S=3] RewriteRule ^wp-includes/[^/]+\.php$ – [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L] RewriteRule ^wp-includes/theme-compat/ – [F,L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Options All -Indexes If you don’t want to change anything on .htaccess you may try this out add_action(‘template_redirect’, ‘redirect_core’, 50); add_action(‘init’, ‘redirect_core’, 50);…

sudo chown -R www-data /var/www/html open your .htaccess folder and put this line inside of .htaccess files Options All -Indexes Your .htaccess file now looks like # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ – [F,L] RewriteRule !^wp-includes/ – [S=3] RewriteRule ^wp-includes/[^/]+\.php$ – [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L] RewriteRule ^wp-includes/theme-compat/ – [F,L] RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # http to https RewriteCond %{HTTP:X-Forwarded-Proto}…

Use this 4 step method to remove the redirect loop and mixed content problems when using ssl in WordPress. 1) Replace ‘http://’ with ‘//’ in database – This create all the relative url’s for images and other assets 2) in wp-config, define generic wp_home and wp_siteurl variables. define(‘WP_HOME’,’//’. $_SERVER[’SERVER_NAME’]); define(‘WP_SITEURL’,’//’. $_SERVER[’SERVER_NAME’]); 3) If you are using a load balancer, use ‘HTTP_X_FORWARDED_PROTO’ server variable to figure out the protocol used. To do this, add this line…

Add below code within .htaccess file RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.in [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domain.in/$1 [R,L] $ sudo nano /etc/apache2/sites-enabled/000-default.conf <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName #…