Questions tagged [regular-expression]

A sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.

36 questions
29
votes
2 answers

Can we use regex in robots.txt file to block URLs?

I have a few dynamic generated URLs. Can I use regex to block these URLs in a robots.txt file?
Sudheera Njs
  • 724
  • 1
  • 5
  • 11
4
votes
1 answer

.htaccess 301 redirect dynamic URL with regex?

How to do this with regular expression? Old -> New http://www.example.com/cat1/cat2/cat3/tool-model-10 -> http://www.example.com/tool/tool-model-10 http://www.example.com/cat1/cat2/cat4/tool-model-11 ->…
Pretzel
  • 73
  • 4
4
votes
1 answer

.htaccess rule fails when including $ at end

The Basic Situation We have a server. It has some static files, some simple, "flat" .php and .html pages, but it also has a WordPress install at the document root, meaning that visiting / takes the user to the WordPress site. The static files are…
rdm
  • 41
  • 2
3
votes
1 answer

How can I get a regular expression to only match an empty string? (In a .htaccess file)

I try to make a regular expression in a .htaccess file, that matches only an empty string. I have tried many things, but it seems like it’s impossible. For example, I tried ^$, but it's looking for "" that will always exist in a string. So I seek…
3
votes
2 answers

Apache 2.4 with regexp - is the alternation operator broken, or am I confused?

I have several document root directories, /opt/lampp/htdocs/proj1, /opt/lampp/proj2, etc, that have AuthType Basic password protection. I want their uploads sub-directory trees not to require a password. Except that the private sub-directory tree of…
sootsnoot
  • 193
  • 1
  • 8
3
votes
2 answers

301 redirect the home pages but keep sitemap pages same

I have manually redirected my entire site. The only page that's left is the homepage. How do I redirect my homepage to the new site (http://example.com) but keep my sitemaps on the old domain (www.example.com)? Below is the structure for the sitemap…
dasickle
  • 3,658
  • 18
  • 40
3
votes
1 answer

Standard WordPress mod_rewrite rules interacting with one of my own rules are causing all requests for a certain page to be sent to the homepage

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22. I can't share the domain that I'm working on, and must sanitize any config files and log outputs. While the website is public, any problems I'm working on in connection…
Wesley
  • 254
  • 1
  • 14
3
votes
2 answers

Can't get rewriterule substitution to work

I am trying to use Apache rewrite to turn something like https://www.example.com/sub/?v1=123&v2=456 into https://www.example.com/sub/?v1=789&v2=456 i.e. changing v1 to a specific value and keeping v2. In the real case, there are more…
Fred Andrews
  • 133
  • 3
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
2
votes
1 answer

.htaccess regex 301 redirect after changing site structure?

I`m trying to convert standard 301 redirects using regexp after several changes of categories structures. How to do this with regular expression? Old -> New http://www.example.com/cat1/cat2/cat3/bla1-bla2-bla3-machine-ab123 ->…
Pretzel
  • 73
  • 4
2
votes
1 answer

Apache httpd.conf && .htaccess directives written in PCRE?

I look at the directives syntax of Apache configuration files like httpd.conf && .htaccess and I must say it looks quite similar to PCRE syntax (that stand for Perl Compatible Regular Expressions). But, is the directives syntax really a…
user58733
2
votes
1 answer

How to regex a url to redirect user

Using the regex and the .htaccess file, I want to redirect users to a certain URL. I want to redirect: http://www.example.com/* but not http://www.example.com/CDadmin/* I have tried the following:…
kpone
  • 21
  • 1
2
votes
1 answer

Google Analytics, filter ALL but a few URL parameters

My sites is being bombarded with new and old URL parameters. At first I tried to add those to the list of excluded URL parameters. With that list now exceeding 200, I wanted to try and use a GA advanced filtern. However, the only filter I found…
chriscross
  • 41
  • 3
2
votes
1 answer

Are regexp advanced filters in Google Analytics Site Content reports supposed to be case sensitive?

When I apply a Matching RegExp advanced filter to a standard Site Content > All Pages report, the regular expression seems to be ignoring case sensitivity. The screenshot attached shows a very simple example - a search for 'Search' returns results…
DJW
  • 23
  • 3
2
votes
1 answer

How do I build a custom report of referral traffic for a set of domains in google analytics?

I am building links for my client's website and need to make a custom report in google analytics to show traffic only of the links i build. I have tried the following: Set up custom report Define metric groups dimension drilldown: defined "referrer…
user1721135
  • 678
  • 1
  • 8
  • 21
1
2 3