Tag Info

New answers tagged

0

I would suggest an alternative route: the rewrite API - did you know it supports external URLs*? function wpse_199898_add_htaccess_rule() { // No need for the caret "starts with", WP will add it add_rewrite_rule( 'article/([/_0-9a-zA-Z-]+)$', 'http://www.domain.tld/?id=$1 [R=301,L,NC]' ); } add_action( 'init', 'wpse_199898_add_htaccess_rule' ); ...


0

After reading up on the issue I decided to go a different route altogether, and hook into filters instead of using insert_with_markers()


0

I would use the wp hook, which fires right after the request has been parsed and queried: function wpse_199869_wp( $wp ) { if ( ! is_admin() && is_404() && preg_match( '/^bh-job/', $wp->request ) ) { wp_redirect( home_url( user_trailingslashit( 'jobs' ) ) ); exit; } } add_action( 'wp', 'wpse_199869_wp' ); We ...


0

If you have chosen 'Default' Permalinks, .htaccess can be deleted. Doing that in my case solved my problem of Plugins settings page & Updates settings not loading (instead index.php homepage would load).


0

The rewrite condition !-f means "if file does not exist". Since the files exist, the rule is never reached. Just changing the order should fix the problem. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-content/uploads/(.*\.(jpe?g|gif|png))$ watermark.php?p=br&q=90&src=wp-content/uploads/$1 [L] RewriteRule ^index\.php$ ...


0

Not sure what exactly you want. Can you please elaborate your question a bit more? If you want URLs like www.mysite.com/subfolder/postname (where the subfolder is where your WordPress install is), then just go to Settings > Permalinks and change it to Post Name. EDIT If your WordPress install is in subfolder and you want URLs like ...


1

This is by design and intentional. WordPress rewrites have become increasingly complex over the years, and many plugins utilise the page endpoint for a page (usually with a template and custom query) - redirecting introduces a potential world of pain. Long story short, it doesn't matter anyway. WordPress adds <link rel="canonical /> for pages, so no ...


0

I solved it. Apache server doesn't allow VHosts pointing to outside /var/www. So I changed all (Document root AND Directory) to /var/www/site and it worked on all sites, with permalinks working fine.


0

Select Custom Structure in permalinks and add /%category%/%postname%/ after your domain. Adding "/" to the category base doesn't work, you have to add a period/dot. I wrote a tutorial for this here: remove category from URL tutorial


1

The RewriteEngine On line (as you have indicated) isn't necessary, and pertains to a different module, mod_rewrite. You should remove it from the mod_headers block. It's possible that you don't have the Headers Apache module installed or activated on your host. If it is possible to run the test with some breakage, you could try removing the If block and ...


1

There is a simple approach to hold download access on your file. 1. Using .htaccess: Upload a .htaccess file into your wp-content folder. Have a look if one exists already, then append this code to the end of the file. If you don’t have one, just create a new blank file and add this code to it: RewriteEngine On RewriteCond %{HTTP_REFERER} ...


0

You are redirecting the entire domain hence breaking the site, because whole website is getting redirected to a part causing a broken website. So instead of using .htaccess just create an index.html file in your root and do a simple Meta Refresh Or Use this more detailed explanation to do the same using php


0

It should work with this lines which simply remove the .php from files that end with .php: RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]



Top 50 recent answers are included