Wordpress menu items are not https links - wordpress

I want to use https instead of http on my wordpress site. The site is now running https and there is only one problem.
short facts of my past steps.
Change the site and home url over the admin backend from http to https.
Use Search and Replace Plugin and search http://'url' and change to https://'url' for all tables and fields except the guid.
Now the issue.
My site works over https with every page but the wordpress site generate for the menu only http links. There are 3 menues of the site and every menu has only http menus. Why? How does Wordpress generate these links?

In case you never figured it out, I just did after encountering this issue lately and finding this question.
In current WP admin go to Settings > General.
Then simply add s after http.

Based on the actions you have already taken, there are two possible cases (assuming your menus haven't been defined by a plugin):
Menu links are improperly hard-coded in template files.
If this is the case, you will need to find the relevant template files in your active theme (or create a child theme) and edit them. The proper way of defining hard-coded links in this case (if they must be hard-coded) is to use template tag functions such as site_url(), which will automatically prefix links with the proper scheme and URL.
Custom links have been defined in menus, in the WP-Admin.
If this is the case, you can head to WordPress Admin --> Appearance --> Menus and edit the custom links in each of your menu items.

Have you thought about using:-
https://en-gb.wordpress.org/plugins/wp-force-ssl/
This will force all of your internal links to use https://
It's the same as #SergeyAn answer but you don't have to edit the .htaccess file directly.

You can try to use htaccess rules like this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Related

How to change .../wp-admin/... (not just the login page)

As a process of white labeling WordPress websites for my clients I was wondering if I can mask admin panel URLs from these:
https://www.somerandomaddress.com/wp-admin/index.php
https://www.somerandomaddress.com/wp-admin/post.php?post=12&action=edit
to these:
https://www.somerandomaddress.com/admin/index.php
https://www.somerandomaddress.com/admin/post.php?post=12&action=edit
Preferably I don't want to change core WordPress code so official WordPress updates can be applied without any problem.
You need to modify your .htaccess in order to wp work as before and see the url only changed.
Try this:
RewriteRule ^wp-admin/(.*)$ /admin/$1 [QSA,L]
For that you can use the plugin
Protect Your Admin

htaccess redirect when URL contain Brackets on wordpress

I need to convert old hosting site URL where they contain (pid) eg
/reviews/(pid)/*
where * is a 5 digit unknown number eg 88326
to
/reviews/
I tried
RewriteRule ^(.*)\/reviews\/\\(pid\\)\/(.*)$ \/reviews\/ [R=301,L]
It is a wordpress site so not sure if that is a reason its not working.
When mass changing URLs in WordPress, I often use this handy plugin.
Velvet Blues Update URLs
FEATURES:
Users can choose to update links embedded in content, excerpts, or custom fields
Users can choose whether to update links for attachments
View how many items were updated
USAGE:
Using this plugin is very simple. Once it has been activated, navigate
to Tools -> Update URLs and follow the instructions. Please Note:
Changes are irreversible. If you haven’t used this plugin before,
please backup your website before proceeding.
Example Screenshot:

How do I remove a word from a url in Wordpress using .htaccess?

In the site I'm building there is a post-type called "Focus". Since they need to url to be like www.mysite.com/focus/page-post-name I have the post type slug as "focus".
Of course the archive page is www.mysite.com/focus this is causing an issue since I need a specific page to be an archive page. Metaboxes are used to build and add settings to pages. I can't just create a page called "Focus" since that is reserved by the post-type.
My idea is to create a page called "Our Focus" resulting a URL of www.mysite.com/our-focus.
I'd like to just remove the "our-" from that url to make it appear that the archive is being used.
I've tried setting has_archive to false but that just reverts to using the archive.php page.
I'm mobile and working without access to a test server, so forgive any errors.
It sounds like you need mod_rewrite, it should be packaged with apache, but may be off. Typically you'll have to check the mods_enabled directory in your apache conf directory, or search your conf file for rewrite.
You'll need two lines in your htaccess at least.
RewriteEngine on
RewriteRule ^/focus/?$ /our-focus/
First line is required to enable rewrite.
The second line is the rule declaration, a regex to match, and a destination. The regex should only match focus, and direct you accordingly. Wordpress may take issue, but I think this will work.
Docs for reference
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
You may need RewriteBase depending on setup. RewriteBase is typically used if there are virtualHosts or a different base url then the server expects.

Wordpress. Rewrite url when on custom taxonomy

It's a wordpress site. I am using a plugin called media tags. This plugin create a custom taxonomy called 'media tags' to display media that has been tagged. The url for these pages are currently domain/blog/media-tags/results
I would like to remove the blog part only when on a media-tags page. So I end up with:
domain.com/media-tags/results
but the standard blog posts,categories & tags still keep the blog part of the url:
domain.com/blog/cat/post-title, domain.com/blog/cat, domain.com/tag/post-tag
Is this possible please?
I'm assuming you just need a snippet for your .htaccess file.
RewriteEngine on
# condition to avoid recursion:
RewriteCond %{REQUEST_FILENAME} !blog
# your rewrite rule:
RewriteRule media-tags blog/media-tags
When the server receives a request to domain.com/media-tags/results it will rewrite the target URL as domain.com/blog/media-tags/results.
I guess you will also have to configure your plugin to point the URLs to the root directory of your server. From the Media Tags plugin homepage:
You can also change this ‘/media-tags/’ URL parameter to something of your liking like ‘/gallery/’. To do this log into wp-admin and go to the Permalinks page under Settings. At the bottom of the page you will see the input field for Media-Tag. Simply enter your preference and update the page.

How to internally add /blog/ to the url with .htaccess?

Hi I have wordpress installation in subfolder /blog/, as it has to co-exist with other legacy cms, so now if i wish to access some page of wordpress i need to use links as
www.domain.com/blog/news/ and would like to rather use www.domain.com/news/.
So basically for certain links i need to add this /blog/ somehow internally so wordpress
would handle it normally.
Please note it will be few links so rewrite rules can be literal.
Rewriting URI's for wordpress can always be kind of sketchy because wordpress has its own way to do routing and may not play nicely with other rewriting sometimes, but you can try:
RewriteRule ^/?news/some-page$ /blog/news/some-page [L]
As long as they're before any other wordpress related rules.

Resources