Remove date in images's url on wordpress? - wordpress

When I upload images in Wordpress I get:
http://test.net/wp-content/uploads/image name**-20210601-071141**.jpg
however I would like it like this:
http://test.net/wp-content/uploads/image name.jpg
See how the date and 071141 isn't in the URL on the 2nd one? That does not happen for all images that I upload but that happens only for some images
Anyways, is that possible? To remove the what is between ** date and that code stamp from the Image URL?
Notice that On Media Organize my uploads into month- and year-based folders is UNCHECKED and even I remove the old images and regenerate the thumbnails again . I get the same problem !!! I don't have any pluging can do something on images

you can apply rule in .htaccess file
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://yourwebsite.com/$3

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

How to Upload webp Image in Wordpress?

Google Webpage speed Give guide lines upload Image in webp format. Then Increase page speed.
In Wordpress CMS not accept webp file.
Hi do you ONLY need to upload the .webp images to wordpress? NOT display them?
if you just wanna upload the images, then go to wp-config.php and add one line to it:
define('ALLOW_UNFILTERED_UPLOADS', true);
then you can go to media library and upload the images,
however if you want to also display these images, here are some tools([useful article link][2]) that you may need to use, such as : cache enabler,
if any further questions please leave a comment. :)
Put this code at the end of the config.php file. Your problem will be solved
//** *Enable upload for webp image files.*/
function webp_upload_mimes($existing_mimes) {
$existing_mimes['webp'] = 'image/webp';
return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');

Hide/rename a word in URL

This is the url of my page http://cbiance.com/wordpress/. Is there a way to hide 'wordpress' in the url or change it to something?
Thanks
The "/wordpress/" is the dir of the page. You can either
Rename the dir and change all the referring documents fo correct it (This includes any other page that links to it and Configuration files like your apache.conf for example.
You could also move the page to the location of url that you would like and redirect from the current page, allowing old links to remain valid.
Use configuration of your apache.conf (or whatever your using) to chang your root dir to this location turning the current URL into "
http://cbiance.com/
The third is the preffered method.

How to remove the the word "category" from the URL of a WordPress category NOT the post?

I have a category by the name "mycategory".
The URL of the category is currently - http://mixerp.org/blog/blog/category/mycategory/
but I need to change that URL to - http://mixerp.org/blog/blog/mycategory/
I tried playing around with the permalink settings but unfortunately I was unable to solve my problem. Currently, I have set the permalink settings to "Day and name". Can anyone kindly help me on this ?
You should use a Custom Permalink if the other options aren't working.
Make sure you delete the %category% part of the permalink, and this should solve your issue.
you can do this by change in .htaccess file,
First backup your .htaccess file. Then, open it and append the following line:
RewriteRule ^category/(.+)$ http://mixerp.org/blog/blog/$1 [R=301,L]
Once saved, your categories pages will be displayed like this:
http://mixerp.org/blog/blog/mycategory/
But i will prefer the answer given by Ronan Murphy, which is easy and safe

Directory problems when using permalinks in wordpress

I am running into a problem when coding a theme.
My wordpress folder lives in public_html/
The permaline setting is set to "Post name", so it is something like http://websiteurl.com/post-name/
In my theme, I want to load an image that lives in public_html/media/, but when I use
<img src="media/img.jpg">
the browser tries to find the image in the folder public_html/post-name/media/img.jpg. How should I code my theme so this does not happen? I don't want to change my permalink option to ?page=ID.
Thank you!
It will better to use full absolute path like
<img src="http://websiteurl.com/media/img.jpg">
. So it will not create issue when your path will
http://websiteurl.com/category/post-name/
Try
<img src="/media/img.jpg">
instead. The first / will make the browser start looking under public_html instead of under post-name.

Resources