I am facing some issue with url rewrite for wordpress
I have URL like this:
http://example.com/mentor-profile/?mentor_slug=dr-jonathan-fass
http://example.com/mentor-profile/?mentor_slug=neha
This is not user and SEO friendly, I want URL like this:
http://example.com/dr-jonathan-fass
http://example.com/neha
I am doing change in .htaccess file but something going wrong. Thanks.
Basically, Wordpress allows you to use SEO and user friendly URLs, just change your permalink settings in Administration area -> Settings -> Permalinks and set them to Post name.
More information - here.
You can use wordpress plugin to edit url whatever you want like below:
http://wordpress.org/plugins/custom-post-type-permalinks/
Or search another on the same site which suits to your requirement
The desired redirects could work for example like this:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.*)&?mentor_slug=([^&]+)&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /%2? [R=302,L]
Anyway, you should also define other cases, like:
Is it possible, that there are folders before the parameter? What should happen for example in the following case:
http://example.com/mentor-profile/test/asd/albala/?mentor_slug=dr-jonathan-fass
Should these folder be kept or be cut?
What should happen, if there are any other parameters, for example:
http://example.com/mentor-profile/?test=asd&ala=balab&mentor_slug=dr-jonathan-fass&hi=hello
Should other parameters be kept or be lost?
Related
I need to redirect my store customers to another clone installation in a sub-directory.
For Example:
A US visitor can visit: ‘example.com/product’
When a Canadian visitor visits the same link, it should redirect to: ‘example.com/ca/product’
I have tried out a few geo redirection plugins but the issue is as follows:
The redirection goes to ‘example.com/ca’ and the ‘product’ part is left out.
Any fixes?
NOTE: I have a clone installation of ‘example.com’ on ‘example.com/ca’.
I didn't need such a comprehensive multilingual plugin setup in my wordpress installation. So I have just used multi-site and added this to my htaccess file to redirect users to my 'irish' site based upon browser language config:
RewriteCond %{HTTP:Accept-Language} ^ie [NC]
RewriteCond %{REQUEST_URI} !ie [NC]
RewriteRule ^(.*)$ https://yoursite.com/ie [L,R=301]
I hope this is a quick and easy fix for someone. As I tried doing an action in functions.php and kept going around in circles for an hour!
You should use the plugin WPML for multilanguge. With this plugin you can use the option redirect by language WPML > Languages > Redirection according to browser language. I have it set up like this in a website of mine and it works fine.
If you want do it trought IP, you will need to add some more work. Im sending you info, I hope it is useful for you:
https://wpml.org/forums/topic/autoselect-native-language/#post-284007
http://wordpress.org/plugins/geographical-redirect/
https://wpml.org/forums/topic/how-to-detect-ip-location-and-automatically-display-local-language/
I am trying to show the content of one domain with the url of another. So for example if I go to example1.com I would like to show the content of example2.com without changing the url name.
What I have right now is the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example1.com
RewriteRule ^(.*) example2.com/$1 [P]
This works great, but the next step to this that I would like is for internal hrefs of example2.com to remain as example1.com in the url.
So if on the copied page there would be a link to example2.com/about I would like for it to become example1.com/about instead.
Is this possible with htaccess? if not what would be the best way to approach this.
P.S. This is a WordPress site - so if anyone has a good WP specific way of achieving the above that would be fine too.
Thanks in advance!
I am looking to get a rule setup to change one of my URL's. After much research I understand the basics of mod_rewrite. The trouble I am having is the dynamic URL that is being re written. I have outlined in as much detail possible the task and desired outcome.
I currently have a url that looks like this:
http://www.myndness.com/my-canvas/{username}/
The {Username} is variable depending on which user you click on.
What I need to do is add /?my_posts to the end of that URL. This will then display the posts module by default for all users.
So all the users will follow the same URL pattern:
/User1/?my_posts
/User2/?my_posts
/User3/?my_posts
/User4/?my_posts
Apologies if I have missed anything.
I am using WordPress and have access to all files on the server.
Try this:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^my-canvas/[^/]+/?$ $0?my_posts [R=301,L,NC]
I am in need for some HTACCESS support here. I dont believe it is very complex if I read through all the comments on similar request but simply dont get it working on my side - even after rebuilding the Permalinks.
This is my situation: I use WordPress 4.2.2 and have a theme with a portfolio. The slug of this portfolio is /portfolio/ which I want to change to /examples/
Now I have a second slug for the categories of this portfolio /PORT_CAT/ which also need to be rewritten to /example-cat/
The url is like: http://wwww.domain.com/portfolio and http://www.domain.com/port_cat/
Can somebody support me with the URL rewrite state to add to my HTACCESS and if required additional steps to rebuild the structure properly so it reflects in the front-end/browser?
Thank you in advance for the support!
This should do it, but I'm not sure why you can't change the URI in Wordpress.
RewriteEngine on
RewriteRule ^examples/?$ /portfolio/ [QSA,NC,L]
RewriteRule ^example-cat/?$ /port_cat/ [QSA,NC,L]
We want to make a 301 redirect in the htacces in our wordpress installation for the following situation. This morning in our webmaster tools we see 8000 new 404 pages not found. In the image below we have made a printscreen. We do not know were these url's come from because we do not use this url structure. As you can see in the printscreen everything starts with:
order/order.html?AddID for example: order/order.html?AddID=1014&Rand=920505296661072670
It looks like the old owner of the url has something to do with this. Now we want to redirect everything that starts with order/order.html?AddID to the homepage. At this moment we see 8000 not found with exactly the same url and only a different AddID.
Is this possible and if so does someone has the best way to redirect these url's?
You should just tell Google not to take into account these url parameters. In Webmaster tools, go to Exploration -> URL Parameters and declare that AddID and Rand do not change the page rendering.
Insert this code just below RewriteBase line in your WP .htaccess:
RewriteCond %{QUERY_STRING} ^AddID=.+ [NC]
RewriteRule ^order/order\.html$ / [L,R=301,NC]