I have wordpress website, which has dates and .html in urls in internal links, for example
https://www.example.com/2022/07/my-first-posts.html
i want to remove dates and .html with PHP regex search & replace plugin so urls will look like this
https://www.example.com/my-first-posts/
how to perform search and replace?
This is screenshot of plugin
i tried
/(\d*)/(\d*)/([A-Za-z0-9-*])(.*?)\.html
to perform search and replace but it is not working correctly.
Related
In many php websites URLs is written as page.php?id=123 or rewrite moded page/Id/123
But is google I noticed that URLs is like google.com/search?q=Wordpress
I try to format website links to be similar but I didn't succeed even with rewrite rules
Also I found websites use same URLs formatting
Torrentz2.eu
How to apply this type of links in php application?
You need to save slug for each record.
for example
title of a product: A4Tech Mouse
slug : a4tec-mouse
so you can set url
example.com/searc?q=a4tech-mouse
and set htaccess rule for above url
When running a search within WordPress it also seems to be picking up image links within the search leading to lots of unrelated articles being picked up. For example if the domain were example.com and you searched for "Example" it is finding any page that contains images or internal links in the HTML as the word example appears in the domain name being linked even though there is no other mention of the word "Example" within the content.
Is there any way to filter the search to ignore the HTML links? I can find many examples of plugins and code to remove pages or post types but nothing to ignore the raw HTML where it is purely functional.
Use Plugin- https://wordpress.org/plugins/search-exclude-html-tags/
2.If you have installed SEARCH EVERYTHING Plugin then change its settings because by Default it takes all HTML tags information during search operation.
I'm working on a custom theme template for Word Press and I was wondering how to read the variables from the SEO friendly URLS. The website admin can choose between standard URLS http://yourdomain.com/?p=10, which is easy enough to read from with $_GET['p']. But how do I go about reading from the SEO friendly urls http://yourdomain.com/your-page-name/.
Thanks.
Are you on the page http://yourdomain.com/your-page-name/ trying to get the $_GET['p'] value? Just call $_GET['p'] it should work and should have a value of your-page-name. To my understanding mod rewrite only masks the look of the address for the browser bar, but the url is on server side still handled the same way.
Or are you on a different page and you are examining the link http://yourdomain.com/your-page-name/ trying to figure out how to get your-page-name as a variable? For that I would suggest you do either a string split, string position, explode, or regular expression... Many options I think.
I'm putting a search engine on my site, and the search box appears on several different pages.
The output looks like this: http://mysite.com/mypage.php?bluepart=search&keywords=dogs&go=Go
I'm trying to do an .htaccess mod rewrite to where any page that passes these variables will get redirected to search_results.php. The bluepart=search and go=Go will always be the same, but keywords can be any number or words. Also, some of my pages are .html and some are .php, when I refer to any page that passes the variables.
Take a look at the RewriteCond option. It allows you to specify a rewrite if an regular expression matches the Query string (QUERY_STRING).
On a download site, I want to scrape all the URLs for the mirror sites. I am using PHP.
For example, on this page:
http://drivers.softpedia.com/progDownload/Gigabyte-GA-P55A-UD3-rev-10-Intel-SATA-RAID-Preinstall-Driver-9501037-Download-99091.html
I want to extract the following URLs:
http://drivers.softpedia.com/dyn-postdownload.php?p=99091&t=0&i=1
http://drivers.softpedia.com/dyn-postdownload.php?p=99091&t=0&i=2
Try with:
(http:\/\/drivers\.softpedia\.com\/dyn-postdownload\.php\?p=\d+&t=\d+&i=\d+)
It is unclear where you got the "t" and "i" parameters from the source url, it only contains the id (p). The below should do for retrieving that last group of digits.
%(\d+)\.html$%