How to redirect non existent pages/posts in wordpress using htaccess
This should work: RedirectMatch 301 ^/products/cool-tshirt$ http://yourdomain.com/tshirts$1 You can also see a bunch of other options and solutions here Hope this helps.
This should work: RedirectMatch 301 ^/products/cool-tshirt$ http://yourdomain.com/tshirts$1 You can also see a bunch of other options and solutions here Hope this helps.
This is the solution I finally found after many hours investigation: RewriteRule ^subfolder1/(.*)$ http://www.domain.tld [R=301,NC,L] With the above code in the .htaccess-file, which is located in your websites root directory, all URLs which contain www.domain.tld/subfolder1/* are redirected to the root domain. Hope this will help anybody else than me 🙂
Finally fixed this errow after browsing for a couple of hours and trying many options. In this block in your Apache httpd.conf file, (located in my CentOS instance at $ sudo vi /etc/httpd/conf/httpd.conf) # # AllowOverride controls what directives may be placed in .htaccess files. # It can be “All”, “None”, or any combination of … Read more
When you include index.php/ at the start of your custom permalink structure you are telling WordPress to use PATHINFO permalinks. WordPress Codex – PATHINFO: “Almost_Pretty” It is possible you are using an IIS (Windows) server or that mod_rewrite is not working correctly. Permalinks without mod_rewrite The following plugin can help you determine if mod_rewrite is … Read more
.htaccess rules are interpreted and applied on every request, they don’t linger on server level and changes apply immediately. However if you had had 301 redirect set up then it can be cached by browser very aggressively. I do not observe redirect you are describing, so that is likely the case. Note that your home … Read more
Use Database Search and Replace and replace the IP 192.168.33.21 with the domain name project.dev.
Why do you want to use .htaccess to do this? Why not just move to the new URL? Alternatives include adding something similar to one of the following to your .htaccess file (note the 301 “permanently moved” code being sent back to the browser in both cases): RedirectMatch 301 /e /wp or <IfModule mod_rewrite.c> RewriteEngine … Read more
If you want wordpress to behave nice when asked to serve content from example.com you need to configure it to know that. This is done automatically at the install process for the domain on which wordpress is installed on but can also be controlled from wp-config.php by setting values to the WP_HOME and WP_SITEURL constants. … Read more
It is the way the .htaccess wordpress generatea instructs apache to work on the wordpress directories The relevant parts from the default .htaccess RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] The first line will cause the rewrite engine to bail out if there is a file with the same name as the … Read more
Myself found the answer. I added <?php wp_redirect( ‘http://www.mydomainname.com’, 301 ); exit; ?> in single.php page.