Wordpress of the post url redirect? - wordpress

I have set the Permalinks to custom /%postname%/ . eg: a post id is 2, its url is
`mysite.com/test.`
i want to when the user access mysite.com/?p=2 it redirect to mysite.com/test
how do i do? or is there a pludgin to get that thank u.

You don't need any plugin for that since it is the default behavior, except if you are using a very old version of worpdress.

a little bit of googling:
http://yoast.com/wordpress/permalink-redirect/
Quote from the page:
That way, a URL like this:
http://www.example.com/page1/?q=ek
Will be automatically redirected to:
http://www.example.com/page1/

Related

Change a specific url to other url in wordpress using function or htaccess

Hi i have a woocommerce product and its url is http://localhost/project/product/my-product/
For this specific url i want to change the url in to
http://localhost/project/my-product/ .
Or some one take http://localhost/project/my-product/ he need to see http://localhost/project/product/my-product/ content without changing .
Is that possible using htaccess or any othe function
you can hook up into redirect rules, here is an article for that https://rudrastyh.com/wordpress/change-specific-urls.html

web.com/post/post-title redirects to web.com/post-title

I'm having a complain of the SEO guy because a post url is not like this
web.com/blog/post-title
But like this
web.com/post-title
And even web.com/blog/post-title redirects to web.com/post-title
How could I restore normal behavior? it looks like they are being treated as page but they work as posts in web.com/blog
Go to Settings -> Permalink
Choose the Custom structure and fill the value with /blog/%postname%/
Need to update the htaccess inorder to get the old path works OR you can set the permalink is to /blog/%postname%/ like this
Please refer this link:
https://wordpress.stackexchange.com/questions/19238/how-do-i-add-blog-as-a-prefix-to-permalink-structure-for-blog-posts-tag-pages

WP Rewrite - Add post ID to URL

I have a custom post type (job) in my WordPress theme.
Posts of this type are inserted by users themselves, but if two or more jobs are inserted with the same title, the slug will be:
www.mydomain.com/job/title-choosen-by-user
www.mydomain.com/job/title-choosen-by-user-2
www.mydomain.com/job/title-choosen-by-user-3
...
Is it possible to keep the same slug and add the post ID in the URL using any rewrite? The result would be:
www.mydomain.com/job/100/title-choosen-by-user
www.mydomain.com/job/101/title-choosen-by-user
www.mydomain.com/job/102/title-choosen-by-user
...
Any help would be appreciated.
Thank you
Perhaps try changing your permalink structure in Settings > Permalinks under the WP admin dashboard.
Try:
/%post_id%/%postname%/
Ok I found a small but working tutorial for custom permalinks structure
http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2

How do I prevent Wordpress from stripping the "at" sign (#) from the URL query string?

I am trying to pass an email address to a wordpress page like so:
http://www.website.com/?email=fakeemail#yeahwho.com
However, Wordpress turns it into this:
http://www.website.com/?email=fakeemailyeahwho.com
I even try URL encoding it like so:
http://www.website.com/?email=fakeemail%40yeahwho.com
But Wordpress is too smart and still removes the %40.
I understand that # is a reserved character, but I should be able to still use the URL encoded version. Alas, Wordpress does not want it to be so.
How can I force Wordpress to respect the # sign? I'm guessing I'll either have to hack the internals, or do some mod_rewrite magic.
from http://www.webopius.com/content/137/using-custom-url-parameters-in-wordpress
First, add this to your theme's functions.php file (or make a custom plugin to do it):
add_filter('query_vars', 'parameter_queryvars' );
function parameter_queryvars( $qvars )
{
$qvars[] = 'email';
return $qvars;
}
Next, try passing ?email=fakeemail-AT-yeahwho.com in the URL and then converting it back with something like this:
global $wp_query;
if (isset($wp_query->query_vars['email']))
{
$getemail = str_replace( '-AT-', '#', $wp_query->query_vars['email']);
}
// now use $getemail
This would only not work in the very rare occurrence of an email that actually has "-at-" in it. You could replace for an even more obscure string like '-AT6574892654738-' if you are concerned about this.
Whatever your final solution, don't hack the core to get it to work. :)
I was having a similar problem and I was able to isolate the issue to an SEO plugin. I'm sure the plugin added a filter to the functions.php but as the plugin wasn't being used uninstalling the plugin also resolved the issue.
I also had this problem, but it wasn't caused by a plugin. It was a result of the 301 redirect that WordPress does with regard to your Site URL having, or not having, a www. in it.
If my Site URL was defined as http://www.mydomain.com, then this would work as expected: http://www.mydomain.com/?email=user#domain.com
If the user came to the site as: http://mydomain.com/?email=user#domain.com (NOTE: no www), then WordPress would redirect to this: http://www.mydomain.com/?email=userdomain.com (NOTE: the stripped # symbol)
My solution was to hard code the www redirect in the htaccess file, so WordPress would never have the opportunity to mess with my URL. This page gives example htaccess lines to redirect non www to www and vice versa: http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/
I was having a similar problem today when trying to pass Mailchimp data through to a Gravity Form in Wordpress. I found a solution. The original question stated that Wordpress was also stripping %40, but it didn't for me in this instance.
1) In Mailchimp create a new Merge tag. I called mine 'Email Param' and * |EMAIL2| *
2) Export your list of subscribers
3) Copy the normal 'email' column content into the new 'Email Param' column.
4) Do a Find and Replace for all # symbols to %40
5) Import your list and tick the box that Auto-updates that list
6) Update your URL to include the new parameter
* |EMAIL2| *
That worked for me.

how to change the link in the wordpress email with newpassword?

how to change the link in the wordpress email with newpassword?
this information we get when we click on forgot password.
username : admin
password : admin
http://www.example.com/wp-login.php
here i want to change this url "http://www.example.com/wp-login.php" and set my own url... how can i do?
some reference code:
if ( !function_exists('is_user_logged_in') ) :function is_user_logged_in() {
$user = wp_get_current_user();
You can hook into the retrieve_password_message filter
function someFunction($message, $key){
}
add_filter('retrieve_password_message', 'someFunction');
You would then have to use the "someFunction" function to parse the $message variable and change the link.
The message variable contains the entire message. So you could simply trim the message based on the number of characters then tack on your new link...
HTH
(Untested)
Using hooks would be my first thought so that you wouldn't have to edit any core files, however I have used the SB Welcome Email Editor plugin a couple times for this exact reason. Their are a couple plugins like this out their and they are fairly light weight and allow full customization of all Wordpress generated emails.
Try using a plugin such as Theme My Login, which does everything for you.
Editing core wordpress files is never a good idea, when updating wordpress, you'll loose all your work.
You can simply follow steps if you want to edit your code file.
Go to your wordpress folder. Look for the following files:
1. /wp-login.php
2. /includes/functions.php
Change the all the codes which contains wp-login.php into your custom URL.
for example: admin.php or client-login.php
Now you can changed your login/signup URL into your custom URL.
Known issue: You can find some database error if you make any mistakes. Just refresh the page and try with the customized Url it will work...
Example site I used here : http://androideveloper.com/admin.php from http://androideveloper.com/wp-login.php
Cheers.

Resources