I have a link in a page that I want to go to the page named buy-item.php and add onto that ?name=$image_name.
The issue is though that my permalink structure is just my_wordpress_site.com/buy-item/, so when I try to code my href as
buy now
or as
buy now I get a page not found error.
How can I do this?
I sorted it, you can't have name as a parameter, wordpress already uses that, which is why it wasn't working.
Easy fix : rename and move buy-item.php to buy-item/index.php
Heavy fix : RewriteRule ^/buy-item/(.*)$ buy-item.php$1 [QSA,L]
Hope this helps !
Related
Let's say I publish a page in WordPress and it generates a url like this.
mydomain.com/pagestructure
I need to have this structure
mydomain.com/page/structure
I figured several ways of doing that.
Edit url from the page edit screen
Edit permalink structure and use Custom structure there
Edit .htaccess
I can't use the second method because I need this structure only for a single, particular page. Not for all pages.
I can't use third method as it is a bit difficult for me. Sorry for that.
The first method is I want to use as it is the most simpler one. But I am not able to use it because WP does not allow putting "/" at desired places. It re-writes them. If by somehow I prevent the re-writing of "/", maybe via adding a rewrite rule via "add_rewrite_rule", it might solve the problem. Any help?
I have a Wordpress blog installed in a subfolder and I would like to replace a part of the url of the post.
Right now it is like this: http://domain.com/wordpress/{permalink-structure}
What I would like to achieve (without moving the site) is: http://domain.com/{permalink-structure}
I tried changing the site url (and followed the instructions provided by WP on how to do this), but if I do this, my front-end stops working ( I am not retrieving the posts etc through the WP-API and I work with AngularJS)
Is there an easy way to automatically modify the (by wordpress generated) url of all future posts by using a plugin or modifying the source code? Or via .htaccess?
Redirecting via htaccess is my preferred option but when I tried this, the wp-api plugin (accessible via domain.com/wordpress/wp-json/* stopped working
Just to be clear: I am not accessing the posts by the generated URLS, I retrieve them via the API and the only thing I want is that the link object in the retrieved post has a different URL.
I don't know. Just try to help. This is my solution redirect what need to redirect.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wordpress/wp-json/(.*)$ http://domain.com/wordpress/wp-json/$1 [R=301,NC,L]
RewriteRule ^wordpress/(.*)$ /$1 [R=301,NC,L]
you want to change wordpress domain or URL. you need to perform following steps.
1 you need to modify all url's stored in database. I prefer to use https://interconnectit.com/ tool. It is pretty good and easy.
2 Once you update all database urls then you need to login in wp-admin and just update permalink settings.
you need to check plugins too. Some plugins may get deactivated you need to activate them again.
Hope this will help.
check word press codex:
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
you can display your word press without move your directory from sub folder to root folder and can remove sub-directory from URL.
Any ideas on how to rewrite my admin URLS would greatly be appreciated.
I have created some menus using functions.php and they are working properly but I need a way that I can use on my .htacess to re-write my code.
The original URL is displaying like this:
http://www.website.com/wp-admin/admin.php?page=for_buyers
I want it to display like this:
http://www.website.com/wp-admin/menu-sample/submenu-sample/
Thank you!
I don't know how many pages you have to rewrite the urls for but you could do 301 redirects which be easy for a few pages but a bit dirty.. Since it sounds like you already have the new links set-up
Otherwise you need to look through their php code..
http://www.website.com/wp-admin/admin.php?page=for_buyers
Their passing info through the url to direct the user to the correct page.. So they clicked this link, and they set it up so that it goes to page=for_buyers. I would bet this code is in the admin.php, but you would most likely need to edit other php files that get redirected to this admin.php file..
I might be missing your question completely.. Let me know..
RewriteEngine on
redirect 301 /category/product-line/samplepage.htm http://websitename.com/newpage.htm
so the page you are redirecting, just take awaY the domain.com part and start with the slash, then a space, then the full html path of the page you are redirecting to.. start with one and give it a min and see if it works.. then go from there.. the htaccess file should be in your main directory.. wordpress should already have one created and you just add to the end of it..
Good luck -Pat
Go to your settings > permalinks and select Post name
Thanks.
i am changing my website and its old pages were like bellow
http://mydomain.com/keyword_city.html
while i read that its better to use - in page for batter SEO, so i am thinking to use new new page name like bellow
http://mydomain.com/keyword-city.html
first of all i want to know is this better idea to change page URL?
and if i change my URL does this effect on page ranking ?
i want to know how to write single .htaccess so that any request coming for old page will redirect to new URL, the only difference in old and new URL will be _ to -
Thanks
I think you are probably looking for:
Redirect 301 /keyword_city.html /keyword-city.html
to be placed in your .htaccess file.
As other people have mentioned though, probably not going to help a great deal when it comes to SEO. One thing that could however is using rich snippets/structured data:
https://support.google.com/webmasters/answer/99170?hl=en
Can be a lot of effort to do but would really help your presence on Google especially.
The following code added to .htacess should redirect all underscores _ to hyphens -
RewriteRule (.*)_(.*) $1-$2 [N]
I Have a .htaccess file for a blog script which currently generates a number for a blog post based on it's ID in the MySQL database. Is there any way I can change this so that it uses something like $subject as the URL from my PHP file? I have pasted my current .htaccess code below.
RewriteEngine On
RewriteRule ^blog-([0-9]+).html$ index.php?act=blog&id=$1
I hope people can understand what I am trying to describe.
Thanks in advance.
Regards,
Callum Whyte
Using just the subject is probably a bad idea, if you ever change the title, all links to your page (from google, or elswhere) will be broken. I would include both the subject and the idea, that way you'll always be able to match an URL to a blog post:
RewriteEngine On RewriteRule ^blog-[^-]+-([0-9]+).html$ index.php?act=blog&id=$1
This should match everything except a - between blog and the id.
Now you should be able to call, e.g., *yousite/blog-some_title_or_other-494.html* and it will call index.php?act=blog&id=494. This new rule shouldn't break any of your old backlinks either. If it does, let me know and I'll fix it.