htaccess redirect when URL contain Brackets on wordpress - 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:

Related

How to modify URL Structure as per our requirement

As per the SEO standards, I want to modify my URL Structure.
For example :
I have a domain name
domain.com/blog/
on which I have installed WordPress.
Now while posting any blog I am getting my URL as
domain.com/blog/category-name/post-name
Now, I need to have my post URL as
domain.com/category-name/post-name
Similarly, for each category and its related post, I need to modify the URL structure as mentioned above.
Keeping in mind that my domain.com is developed on any other platform, and we have to modify WordPress installed directory/URL domain.com/blog as per our requirement.
Subfolder name coming in between domain name and category name while editing it with WordPress admin dashboard custom permalink.
Not having any idea about this URL structure modification.
Your help will be highly appreciated.
Thank You.
With ,htaccess
This should change domain.com/blog/ to domain.com/
RewriteEngine On
RewriteRule ^/blog/(.*)$ domain.com/$1 [L,R=301]
Install Wordpress directly to domain.com, instead of sub folder 'blog'. Then URL will work as expected.
Otherwise can simply use this plugin:
https://wordpress.org/plugins/permalink-manager/
The plugin works with all custom post types and taxonomies, as well as many popular third-party plugins.

duplicate title tags and descriptions in webmaster tools

Still a bit new at this so please go easy on me and I have tried searching for an answer but have been unable to find one that specifically helps me. I have a wordpress site that I have built a custom php page to deliver results from a database to display information and have manually inserted code to display the header and footer of my wordpress theme.
Also, in my .htaccess I have used the
rewriterule ^used-boats-for-sale/(.*)/(.*)/(.*)/(.*)/(.*)/$ /boatdetails.php?recordnumber=$5 [L]
to forward the friendly url so the php page can process the correct record number to process and display the results. This was the only way I could figure out how to do this in wordpress and bypass wordpress's subfolder killer.
My issue arises as google webmaster tools is telling me I have duplicate title tags and descriptions, even though I have added a canonical reference to the friendly url.
Examples of both can be seen here:
http://www.unitedyacht.com/used-boats-for-sale/hinckley/downeast/cruiser/2000/1807/
and
http://www.unitedyacht.com/boatdetails.php?recordnumber=1807
So with the canonical, why is google still showing it as a dupe and what can I do to correct it? If I put a r=301 in, it redirects the url completely and removes the friendly url from the browser.

Wordpress menu items are not https links

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}

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.

Use title based slugs and archive IDs at the same time

A wordpress site I am working on was previously windows hosted and could not use htaccess to hide the index.php. All 200 or so news items are indexed by the search engines like
sitename.com/index.php/archives/5574‎
The site is now being moved to Linux, and the news items will now be like
sitename.com/big-story-of-the-week
If I change the permalink structure as proposed, is there any way I can get the site to still route the old index.php/archive links?
In your .htaccess file, you can add the following code using your sites URL structure:
Redirect 301 index.php/archives/5574‎ http://sitename.com/big-story-of-the-week
This would have to be done for each page.
More info here: http://wp-mix.com/redirect-urls-htaccess/
(Be sure to backup your .htaccess prior to making changes)

Resources