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.
Related
Sorry for posting my question here as I don't know where I should post it.
I am new to wordpress and now I need to amend the main webpage.
I logged in GoDaddy and I tried to find some files like index.html, index.php, but they are not the page I want.
Which file should I find?
Can you please help?
Thanks
First check which theme you have selected from admin panel
then in folder look for 'themes/YOUR_THEME_NAME'
There look for pages front-page.php/home.php/index.php _ atleast one of these will be present.
Modif6y that file according to your need.
I have a wordpress blog with the following URL structure:
www.mysite.com/2016/09/the-name-of-the-post/
However i noticed that for SEO Reasons it would be better to have a structure like:
www.mysite.com/blog/the-name-of-the-post/
I have around 1000 posts with the "old" url structure. I can change the url structure in wordpress. However i would need a 301 redirect if someone tries to access a post using the old url.
E.g.
person/ google bot tries to access page via /2016/09/the-name
-> 301 Redirect to /blog/the-name
What is the best practice to do so? Do I add 1000 lines to the .htaccess file and do redirects? Would that negatively influence the server response time cause apache has to check through a long list of redirects first?
Can I tweak a file in the wordpress file structe which checks, if the requested page is included in e.g. an array, it will redirect it to the new url?
Thank you very much for your suggestions
You can simply change the URL structure in WordPress to the one you want to have. You don’t have to modify your .htaccess or anything else.
WordPress will understand which post is referenced by the URL and redirect to the new canonical URL automatically.
Just go to the Permalinks admin page and select the “Post name” option as described in the Codex.
However, if you’re introducing a prefix like /blog/, too, you must redirect to the new URL base through .htaccess, e.g.
RedirectMatch 301 ^/[0-9]{4}/[0-9]{2)/(.+)$ http://example.com/blog/$1 // taken from stackoverflow.com/a/42211746/
You can use the following Redirect
RedirectMatch 301 ^/[0-9]{4}/[0-9]{2)/(.+)$ http://example.com/blog/$1
This will redirect all urls from this form /1234/12/foobar to this /blog/foobar
Change the permalink to the new structure and add this in your .htaccess
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)/$ http://example.com/blog/$3
I had the same problem before but I resolve this issue using simple 301 redirects plugin.
https://wordpress.org/plugins/simple-301-redirects/
You can bulk upload 301 redirects using bulk upload add-ons of this plugin.
Hope this will help you.
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 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 !
I'm new to mod_rewrite and need to do something for my client.
Suppose I have the www.mydomain.com/products.php?prod_id=32.
This product has a section (clothes) and a name (shirt). These names and sections are unique.
In a SEO-Friendly Url, it should be www.mydomain.com/products/clothes/shirt/.
I know I can create
RewriteRule ^products/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ products.php?section=$1&name=$2
I can do that, and it works. But I want people who enter www.mydomain.com/products.php?prod_id=32 to be redirected to www.mydomain.com/products/clothes/shirt/ (changed in the browser itself). How can I do that without inserting the id in my url? Is it possible to call a "pre-processing" php file in my .htaccess, and recreate "products.php?section=$1&name=$2"?
Anyone has a good link with really detailed explanation of mod_rewrite?
Thanks!
You may have a bigger problem than mod_rewrite can handle gracefully. You can also use PHP to return a redirect to the browser. That way you can access your database to figure out that product_id 32 is /clothes/shirts/
I see no other option than doing it inside PHP.
You can add something to the top of your products.php page that checks the URL ($_SERVER['REQUEST_URI']) to see if it contains products.php - If it does, redirect the person. You'll need to query your database to find out the product category and the name before redirecting though.
Remember to set the Moved Permanently header to improve SEO further :)
This data might be passed by the browser via the "Referer" header field. You could progress that url and look at the get arguments. If I remember right, this isn't supported on all browsers.
at the top of products.php (or any page you want to redirect) you could put a function call
redirectToSeoUrl();
Then in one of your include files write a redirectToSeoUrl function that gets the new url and redirects. Make sure to put the code before anything is output to the browser.
Apache? Try an .htaccess redirect. No mod_rewrite needed.
Example:
Redirect 301 /oldpage.html http://www.example.com/newpage.html