Questions tagged [regex]
45 questions
5
votes
1 answer
How to make a graph in Google Data Studio showing specific url parameters that were queried in my site?
I have a search page on a hotel property website that can have up to 12 parameters in the url. Note that sometimes it may have none of these parameters. The parameters are all for optional facilities that the hotel could provide. If the…
AdamJones
- 342
- 1
- 2
- 12
5
votes
3 answers
301 Redirects what does ([a-z]+)-(.*) and ([0-9]+)-(.*) mean
I just checked an .htaccess file with some custom redirects. There are two redirects I don't fully understand:
RedirectMatch 301 ^/news/([0-9]+)-(.*) /blog
RedirectMatch 301 ^/news/([a-z]+)-(.*)/$ /blog/$1
Both redirects are redirecting the…
public9nf
- 289
- 2
- 7
5
votes
2 answers
How could I forcibly output the default 403-forbidden error page when http://example.com/not_found is requested?
This is my first question on StackExchange so bear with me, here is a brief breakdown of my current setup:
Two different domains, two different TLDs (.dk and .de) on the same hosting plan
for the sake of privacy, let's assume the domain names are…
GeekRider
- 129
- 2
- 11
4
votes
1 answer
Modify rewrite rule to match ONLY directories, NOT directories AND files
I have the following rule in my .htaccess file:
RewriteRule ^[^/].*/(dir1|dir2|dir3)(.+) $1$2 [QSA]
It works great for the directories except sometimes it conflicts with files.
How can I modify this rule to immediately require a / after each…
John
- 153
- 8
4
votes
1 answer
Why Doesn't "location /" Match Every URI in Nginx
In Nginx, according to this question's answer
https://stackoverflow.com/questions/59846238/guide-on-how-to-use-regex-in-nginx-location-block-section
when using no modifier between the location directive and the URI it means that the URI must begin…
Harry Muscle
- 335
- 3
- 8
4
votes
1 answer
Robots.txt allow directory root while disallowing all deeper URLs
I would like to allow a path and disallow everything else in the directory.
User-Agent: *
Allow: /example/
Disallow: /example/*
Will this work? If not what would be a better way of doing this?
Yaseen
- 81
- 3
3
votes
0 answers
On Google Sheets Google Analytics Add on, how can I filter by page?
I am using the Google Analytics Add on in Google Sheets.
I need to add a filter that enables my report to only show URLs containing the word "blog"
The blog pages are not in a directory, e.g. example.com/blog/url.thmkl, as if they were I could just…
EoinDigitalMarketing
- 31
- 1
3
votes
1 answer
Regex to match a specific page path in Google Analytics based on what it starts with and what it ends with
I need to come up with a regular expression that matches all page paths that:
starts with /google+redesign/ AND
ends with /quickview.
What would a correct regex combination look like?
mr.analytic
- 31
- 1
- 4
3
votes
1 answer
How are slashes added between htaccess mod_rewrite variables
I was looking at two different variants of redirects:
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
And noticed that in the first there is a slash between domain and URI, but in the…
PixelSnader
- 131
- 3
3
votes
1 answer
Rewrite wildcard rule to redirect images that works with HTTP, HTTPS and Firefox HTTPS-Only mode
This set of rules causes the nolinks.jpg image to appear if anyone tries to link directly to an image from a remote site. It is working well but with the latest Firefox, the browser is forced to https rather than http. How can it be made to work…
DonP
- 153
- 1
- 5
3
votes
1 answer
Hide the subfolder from appearing in url
I want to move from www.example.com/_/randomfolder to example.com/randomfolder. It should acces the contents from /_/randomfolder but should show example.com/randomfolder.
What I have tried:
Trial 1
RewriteEngine On
RewriteCond %{HTTP_HOST}…
mrniamster
- 31
- 2
3
votes
1 answer
Redirects for both paths and posts in the path
I rarely need to do redirects and when I do they're usually simple. This time I'm trying to do something a little more advanced and I'm stumped. Regex is hard :)
This is a WordPress site and I'm using the Redirection plugin by John Godley.
I have a…
Brent Eades
- 31
- 2
3
votes
1 answer
IIS URL Rewrite: Pattern starting with forward slash never matches
I am using IIS URL Rewrite and this one has stumped me.
I am redirecting a URL with specific subfolder to a new URL.
e.g. https://myapp.example.com/customsite1 redirected to https://newsite1-myapp.example.com
If I use this…
ChrisYYC
- 49
- 1
- 2
3
votes
0 answers
Filtering Google Analytics pages for Uppercase characters
I'm trying to see if users have accessed URLs with uppercase characters.
I have gone into Behavior>Site Content>All Pages and am attempting to filter using Regex.
However, my syntax is not correct and it is saying I need RE2 syntax.
can anyone…
Kirsty Simms
- 1,257
- 8
- 20
3
votes
1 answer
Is this literal or code in the .htaccess file?
Background: Recently, a business acquaintance contacted me because of strange behavior on his website. As may be expected, I found that the site was compromised.
One of the signs of the compromise is changes in his .htaccess file, which is fairly…
Nora McDougall-Collins
- 413
- 1
- 5
- 12