Wordpress adding subdirectory to permalinks - wordpress

Looking into our Google Analytics it seems some people are visiting pages on our site with the wrong permalink. Specifically WP is adding an extra directory on the end for some reason.
www.mysite.com/contact/ <- Correct
www.mysite.com/mysite/contact/ <- Incorrect (some people ending up here)
It seems every page on the site has this problem (some people ending up at /mysite/page/ instead of just /page/
It's a standard WP install (not in a subdirectory), the permalink structure is set as follows:
www.mysite.com/blog/%postname%/
Looking in GA, all the visitors from the wrong permalink are coming from the source/medium of direct/none.
I've ran a URL checker on the site and everything is coming up as 200 OK with none of the wrong permalinks showing anywhere.
Would appreciate any ideas here, pretty stumped on this one! Only thought I have is that maybe it's something to do with the database containing wrong links as my localhost install was localhost:8888/mysite/.
Thanks, Adam

maybe you can rewrite permalinks with help srdb
search: localhost:8888/mysite
replace: www.mysite.com
with http://
Before doing a copy of the database

Thanks for your responses. After considerable digging it turns out GA was logging visits from my local version of the site. Have resolved now.

Related

htaccess Google Seach Console Redirect Error Problem

My Wordpress website keeps getting refused by google search console, and i've spent a week trying to fix this problem (tried many different solutions). When I used a third party SEO crawler. It located the redirect error to a problem in http://www.examplesite.com to https://www.examplesite.com .
Google: Page fetch error Failed: Redirect error
So, having had experience before with SSL and redirects with htaccess with different websites before, i thought this would be an easy fix. apparently it isn't, and I still can't find a fix. I tried many different htaccess solutions. All my links in the xml sitemap use https. all my wordpress settings are set to https://www.examplesite.com . And I have no idea what I am doing wrong, what change, and what to do. I can only think the problem lies in the htaccess file. And I don't what code to use anymore. (yes, i've also disabled all the plugins)
Thank you.
Found the solution:
Add code in functions.php:
remove_filter('template_redirect','redirect_canonical');

Something is creating strange URLs in Wordpress Website

I have a problem with a Wordpress based website. Something is creating strange URLs. I know about those URLs, because Google Webmaster Developer try to Crawl them and the Crawler gets a 404 error (Not found). I have that problem in different websites:
In the first one the URLs looks like spam:
http://xxxx.com/wp-content/w3tc/apple-iphone-3gs-8gb-black-manual
In the other website the URLs make sense based on the content, but they are not valid URLs:
http://xxxx.com/portfolio/pool-view-suite-bathroom/
In other website, it's creating URLs that looks like valid, but with a ".html" in the final
If you try to access those URLs, you will get a 404 error. Curiously, when you look the "Linked By" tan in Google Developer Tools, you will see that is linked by another strange URL o there is no linked from. And that URLs are not in the sitemap, I checked it.
Thank you!
the first one is a trojan without a doubt. Quite usually, you'll find them in index.php, footer.php, header.php . If in doubt, check with an online tool like Sucuri
Once you isolate it, it's very important to know how you have it. While most people thinks they have been "hacked", in most cases you uploaded it by yourself from your own computer, so be sure to scan it thoroughly.
About the other cases, sounds more like an htaccess issue, but based on the first case, quite probably it's caused by this trojan as well. Ask your host to check the site, it's in their best interest to do it so. But assuming it's just htaccess, try this: go to Settings --> Permalinks and change the permalinks structure to anything else than what you have now. Don't hit the submit button yet. In the meanwhile, BACKUP your htaccess file and then delete it. Hit submit on the permalinks page an a new .htaccess file will be created. Try your site now. If it works, it was just a simple htaccess issue. If not, something else, going from a trojan to a server misconfiguration to anything in between
Maybe the domain was used before and you are seeing past valid urls which are now 404, or maybe these are incorrect, inbound spammy links which you would want to be 404. Duff links can be found anywhere on the internet and so no reason to think your site is generating them.

Permalinks no longer working

I have a nightmare scenario where -- just getting ready to launch a site -- permalinks are suddenly not working and it breaks CSS and can't find PHP templates. I have the permalink structure set to "http://domain.org/%postname%-by-%author%/" but when I click on a post the permalink only calls postname, for example: http://domain.org/%postname%
My host provider checked the htaccess file and can't find any problem. I can't see one either. I have searched around and see many Wordpress users having permalink problems but they all seem to have different solutions. I am at a loss. Any help would be greatly appreciated.
Click update permalinks after moving worspress. Should fix you issue :) Usually in the database the old structure is saved and the new one doesn't work, even if your htacess is ok you should still hit the update permalinks button :)
If that doesn't work try debugging with http://wordpress.org/plugins/monkeyman-rewrite-analyzer/
:)
I am curios why is the css broken. That doesn't depend on whether your permalinks are broken or not. :-S
Have you installed any plugins before it failed?

Migrating Wordpress Permalinks from postname to post_id/postname

My blog's been up for a year or so, and 90% of our traffic comes from Google, so I want to make sure that I'm handling this permalink change properly. I recently read on Wordpress' codex that including the numerical %post_id% at the beginning of your permalinks can greatly reduce the stress on your database, when a post or page is being fetched. So, I decided to change my permalink structure from /%postname%/ to /%post_id%/postname/.
Now, if I type in, or click on a link to my site in google that looks like this - http://blog.com/cool-post/, it seems to redirect to my new structure: http://blog.com/34424/cool-post/ without a hitch. I'm trying to figure out whether I need to use a 301 redirect plugin or not. I would like to think that search engines like Google will see the same "flawless" redirection that I'm seeing. There doesn't seem to be any broken links. Just looking to confirm that I'll be okay after this change.
Thanks
WordPress handles canonical redirects for you by sending 301 Moved Permanently status codes appropriately. That status code ensures Google will only index your posts by the new URLs (i.e. with the post IDs in your permalinks). I've not used a redirection plugin for a while and my sites have been indexed similarly just fine.

Google Search Appliance not indexing

Not too familiar with GSA here so hopefully someone can help me.
Have a Drupal multisite installation, just added another site to it. It all works fine. However, when I go into the GSA admin, it won't crawl the site even though the URL pattern matching is fine.
All it says is this:
"/ Info: Redirected URL"
It hits the homepage and stops. Anyone know why? This GSA powers the other Drupal sites running and works just fine. I haven't any idea what would cause this, robots.txt looks fine, no redirects in the code, its using mostly the same code and modules from sites/all/modules. Puzzled.
Got it. Drupal redirect from bad path_redirect record.

Resources