Images uploading to wrong directory after changing to multisite

Check the value of the ms_files_rewriting option in the site_options table. If ms_files_rewriting is disabled, then WordPress will automatically append /sites/number to that Upload Path value for the subsites. This setting should be disabled by default for any Multisite networks created after WordPress 3.5. It should only be enabled for older networks. If that setting … Read more

Custom rewrite rule

Add the following to your .htaccess, in between the <IfModule mod_rewrite.c>: RewriteCond %{QUERY_STRING} (^|&)filter=all&search_text=&type=(.*)&location=(.*)&cs_directory_search_location=Yes&search_view=&goe_location_enable=No&cs_loc_max_input=5&cs_loc_incr_step=1&submit=&action=cs_directory_map_search RewriteRule ^(.*)$ /directorio/%2/%3/? [R=301,L] You can confirm the logic through this .htaccess tester. Your default .htaccess created from WordPress should now look like the following: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f … Read more

.htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/

You’re close. Add the following to your .htaccess file in between the <IfModule mod_rewrite.c> tags that were created by WordPress: RewriteCond %{HTTP_HOST} RewriteRule ^(.+)-[0-9]+/$ /$1 [R=301] Your .htaccess should looks like the following if it hasn’t been modified by another plugin: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond … Read more

.htaccess 301 vs. 302 Enforcing HTTPS

The different .htaccess/mod_rewrite directives you see around are usually because of differences in the server configuration (nothing to do with WordPress) and where they are being used. There’s no such thing as a one size fits all. (For instance, the above redirect may not work if you are behind an SSL proxy.) However, as with … Read more

RedirectMatch and Redirect interfering with each other

RedirectMatch and Redirect interfering with each other In the example you’ve given, RedirectMatch (mod_alias) and RewriteRule (mod_rewrite) are “interfering with each other”, not Redirect. Redirect is a mod_alias directive, that works with RedirectMatch – so you wouldn’t necessarily expect these to conflict in this way. As mentioned above, RewriteRule is a mod_rewrite directive, whereas RedirectMatch … Read more

How can I code my plugin to safely modify .htaccess?

/wp-admin/includes/misc.php includes the function insert_with_markers() : /** * Inserts an array of strings into a file (.htaccess ), placing it between * BEGIN and END markers. * * Replaces existing marked info. Retains surrounding * data. Creates file if none exists. * * @since 1.5.0 * * @param string $filename Filename to alter. * @param … Read more

Remove File Extension for Page Outside of WordPress

…but that still didn’t remove the extension. To be clear, the extension should already be removed in the HTML anchor/link. The purpose of .htaccess is primarily to rewrite the extensionless URL back to the underlying filesystem path (which contains the file extension). RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] Apart from rewriting to .php, not … Read more