.htaccess on wordpress multisites
-
Hi Moz fans,
I have a site thats uses wordpress multisite.
we have a number of sites set as subfolders i.e /en/ /de/ /us/ /fr/ ect.
I need to force trailing slashes on each site as I currently have the pages being spidered as /about/ and /about and /iso-9001/ and /iso-9001.
I have tried numerous things I have found online in the .htaccess and nothing is working.
Can anyone HELP!!
-
Try the following
BEGIN WordPress
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]END WordPress
If that doesn't work strip it right back save your original htaccess and try just this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]If that doesn't work your mod_rewrite module might not be working check server config..
-
Hi Matt
Thank you for this, should i put it as below
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]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]</ifmodule>END WordPress
-
Hi
Try adding this to your .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]
-
unfortunately this has not solved the problem as my permalinks already contain the trailing slash.
I really think it needs to be code in the htaccess file to add the trailing slash if a non trailing slash url is presented.
-
Thanks for sharing httaccess code....
I have search for your problem and finally I found "Permalink Trailing Slash Fixer" Wordpress plugin( 5 star rating). Please try installing it.
Hope this will solve your problem....
-
one suggestion i found was
<code>RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !example.php RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]</code>
But alas its not working
-
The current htaccess is
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]</ifmodule>END WordPress
-
Can you please show me your .httaccess code ?
-
I am using a custom structure which is
/%category%/%postname%/
In network admin and site path is also /en/
Thats why I need to use .htaccess to process the URL on the fly and add a trailing slash if not there
-
Hi,
Can you check your permalink setting.
Login to wordpress- > Settings > Permalinks
Permalinks help available here: http://codex.wordpress.org/Using_Permalinks
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Anybody with a business site using Webflow CMS or another non-WordPress CMS/ sitebuilder?
If you have built your business site using Webflow CMS, kindly share your insights on how good their CMS is for SEO and how easy it is to rank a site. If you are not familiar with Webflow but have had a positive experience with another non-WordPress CMS/ sitebuilder, kindly share your opinions.
Web Design | | Blu_Ocean99.0 -
Yoast focus keywords for portfolio post types in WordPress
This one is for the WordPress optimization crowd! Portfolios are used to display work. I have a question about best seo optimization techniques. 1. Portfolios can be used to display many different types of work, for me it either original web designs from scratch, WordPress redesigns, or importing a current website into WordPress. What is the best practice for keywords for multiple portfolios that are in one category. for instance WordPress Redesign. If I have 5 WordPress redesign portfolio posts is it good practice to use WordPress redesign for all 5 portfolios or should they use variations? Yoast gets angry when the same focus keyword is used multiple times. 2. Should portfolios even be indexed? Since this is how I attract new customers I would think yes but am I giving too much exposure to my client and not enough to my business. I guess this will depend on titles and meta descriptions. A discussion on best practices here is what I am really looking for. What is your advice and opinion on the matter.
Web Design | | donsilvernail1 -
Is it necessary to Remove 301 redirects from Wordpress after removing the 404 url from Google Webmaster?
There were many 404 urls in my site found by Google Webmaster. I've redirected these urls to the relevant urls with 301 redirect in wordpress. After that I removed these 404 urls from Google Index through Webmaster. "Should I cleanup these 301 redirects from Wordpress or not? ". Help Needed.
Web Design | | SangeetaC0 -
Does anyone know if the YOAST SEO plugin works 100% on a responsive wordpress template?
Hi, Does anyone know if the YOAST SEO plugin works 100% on responsive wordpress template? In other words, when you configure the custom title and metadescription is it also configured for the tablet and cellphone views as well? Thanks Carla
Web Design | | Carla_Dawson0 -
Deciding which Wordpress Platform
Hey Guys, I am trying to choose which is the best platform to use to build my website. I have had a look at the following: studiopress thesis headway woothemes I've just spent a month building a website using the WIX platform only to find out that it's not SEO friendly, so before I start a new site, I just want to make sure I choose the BEST SEO FRIENDLY theme. If someone could please assist that would be greatly appreciated. Also, I already have paid for theme subscriptions to the following sites (before I joined SEOMOZ) are the following SEO friendly? https://www.elegantthemes.com/ http://www.templatemonster.com/ http://www.templatesold.com/ Thanks so much in advance
Web Design | | Giorgio680 -
How do you deal with comment spam: wordpress?
I have akismet installed on my Wordpress blog, and it does a great job of filtering the spam comments, but for some reason my site (and server) gets slammed by the amount of spam comments akismet blocks. If I check my spam folder there will be over 100 spam comments in an hour. (which in turn puts a load on my server.) Does anyone have any thoughts on how to put a stop to this? (Or at least slow it down?) I know I could use a captcha, but I really don't want to put any barriers on people commenting and I don't even like using those captcha's myself. Thoughts? By the way, does anyone know how spam like this works? This has been going on for sometime now. Are spammers just using automated software to do this?
Web Design | | NoahsDad0 -
Is there a Consultant out there to help convert C#.net functions into PHP Wordpress functions?
We are going through a transition from SiteFinity (C# .net windows environment) to WordPress (PHP Linux environment). We currently have custom forms that make calls to webservices and also store data into SQL Server tables. Not sure how to do this in PHP and could use some help. We are located in Irvine, CA. We would prefer someone onsite, but can also work with someone remote if we must. Time is of the essence. Thanks.
Web Design | | balboafinance0 -
Random 302 Redirect (Wordpress CMS)
So this new project that i am working on is a redesigned CMS site using Wordpress (php based). Before i started on the project they made a few major updates that include: Changed from ID based URLS to SEO friendly URLS Added multiple languages in directories www.domain.com/en www.domain.com/fr www.domain.com/de etc... Due to the new languages they wanted to have the previous home page, www.domain.com, redirect to the proper language based on their IP address. Currently they are using a 301 redirect through a php header. So if i was visiting the site from my hometown of Cleveland, Ohio and i type www.domain.com into the browser. I would automatically redirect to www.domain.com/en and i would have the option to switch languages if needed. The issue: When i first added their site into SEOMoz the crawl returned a large amount of 302 redirects coming from their old homepage www.domain.com. So i took a look at the header calls using IE's webmaster tools and Firebug in Firefox. In both profilers it showed the same problem. Before the 301 header redirect there was a 302 redirect called first When viewing the response header it mentioned an x-pingback of some file that didn't even exist on the site: www.domain.com/xmlrpc.php This is obviously a huge issue because any link value from the old homepage will be lost due to the 302 not passing the value. I have tried search the almighty Google for help but it has gotten me no where. I have a hunch it is something to do with Wordpress but that is based on nothing but my gut. Any help is greatly appreciated. I got to get that 302 gone or changed to a 301 🙂 Regards - Kyle
Web Design | | kchandler0