Remove subfolders from URL

You need to make the WP site url and home url differ in Settings / General. The home url should be example.com, while the site url (where WP lives) should be example.com/wp (or wherever you put it). You can hardcode these in your config file: define(‘WP_HOME’, ‘http://example.com’); define(‘WP_SITEURL’, ‘http://example.com/wp’); WP should know how to take … Read more

How do I remove a word from a url in WordPress using .htaccess?

You can add the following to your .htaccess file in between the <IfModule mod_rewrite.c> tags: RewriteCond %{HTTP_HOST} RewriteRule ^our-focus/(.*)$ /focus/$1 [R=301,L] Your .htaccess should looks like the following: # 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] # Custom Rewrite RewriteCond … Read more

Globally force SSL on all pages

To globally redirect all your pages to HTTPS add the following lines to your .htaccess: # Globally force SSL. RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This should be placed directly after RewriteEngine on if you have no previous rewrites.

Redirecting old permalink to new one

RedirectMatch 301 ^/author/$ ^/auteur/$1 This will only redirect /author/, but the target URL is invalid (with a ^ prefix). The target URL is an ordinary string (that accepts placeholders), not a regex. However, since WordPress already uses mod_rewrite directives for the front controller. You should also use mod_rewrite for this redirect (as opposed to a … Read more

Options for restricting access to wp-admin

You could make it a mu-plugin (‘Must Use’ plugin). Any PHP file you put into /wp-content/mu-plugins/ will automatically get included in WordPress. You can’t deactivate the plugin (unless you have ftp access to the server). If you go with a mu-plugin, make sure to put the functionality into a subdirectory and bootstrap it with a … Read more

How to map permalinks with accented letters to sanitized slugs?

The best way to accomplish this is remove the default sanitize_title filter and replace it with yours, which will encode those characters properly. Here is an implementation of using accents in permalinks. Example: remove_filter( ‘sanitize_title’, ‘sanitize_title_with_dashes’); add_filter( ‘sanitize_title’, ‘restore_raw_title’, 9, 3 ); function sweURLtoCHAR($text) { $url=array( “%C3%81″,”%C3%A1”, “%C3%8D”,”%C3%AD” ); $char=array( “Á”,”á”, “Í”,”í” ); $str = … Read more

Htaccess redirect from ‘/%postname%.html’ to ‘/%postname%’

Above the WordPress rewrite rules add: RedirectMatch permanent ^/([^/]+)\.html$ /$1 That will catch example.com/foo.html but not example.com/travel-guides/foo.html. To catch all URLs ending with .html remove the first ^ from the pattern. To redirect all URLs ending with .html except those in travel-guides you need mod_rewrite: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/travel-guides/ RewriteRule ([^/]+)\.html$ /$1 … Read more