Questions tagged [rewritecond]

132 questions
1
vote
2 answers

htaccess .html rewrite exception

Ok guys I need to add an exception! How can I do this? I currently use RewriteRule ([^.]+).html $1 [R=301,L] to rewrite all .html urls I do need the exception for the google.html verification file. How can I set this exception? I tried this but it…
Jason
1
vote
0 answers

Apache Rewrite Based on Query String

I'm trying to detect the presence of a particular name/value pair in the query string and, if it exists, do a thing. I'm trying to do this in a conf file that's stored in conf-available/ and after a2enconf has been run to enable it. The code is…
Rob Wilkerson
  • 1,465
  • 4
  • 17
  • 25
1
vote
1 answer

RewriteCond for APIKEY

I am trying to create a RewriteRule which looks at the incoming Header for an APIKey and if it contains a matching string then it will redirect to respective URL else, it should be inaccessible. I am testing this scenario using postman with Post…
1
vote
1 answer

Apache http to https WITHOUT any adress?

a normal http to https rewrite could look like this: RewriteEngine On # RewriteCond %{HTTP_HOST} !^example.com$ # RewriteRule /.* https://example.com/ [R] but this code specifies the site to "example.com" Is there anyway to make a "global" rewrite,…
Adam Larsson
  • 31
  • 1
  • 6
1
vote
1 answer

htaccess rewrite rule not working with file extentions

I have two domains setup on the same folder on a server. i.e. dl.d123.com @ /var/www/public_html/dl.domain123.com dl.domain123.com @ /var/www/public_html/dl.domain123.com I have an htaccess file in /var/www/public_html/domain123.com with the…
iraqiboy90
  • 21
  • 4
1
vote
1 answer

Should I escape slash '/' in RewriteCond?

Whether I need to escape the slash '/' in RewriteCond? Currently I write the following rule in .htaccess: RewriteCond %{QUERY_STRING} rp=/knowledgebase/ RewriteRule ^index\.php$ https://www.datanumen.com/knowledgebase/ [QSD,R=301,L,NC] However,…
alancc
  • 141
  • 12
1
vote
1 answer

Rewriterule not working with Joomla urls due to question mark and other special characters, also due to long urls

So I moved from Joomla CMS and now I need to finish my permanent redirects, but the following redirect isn't working (it's actually returning an error 404): RewriteCond %{HOST_NAME} =&?$ #RewriteRule…
1
vote
1 answer

Validate QUERY_STRING on RewriteCond for XSS protection

I would like to create a rewrite condition which validate the QUERY_STRING to prevent from XSS. My item look like: /ItemPage.jsp?itemId=item_12345_12 where item_12345 is required and "_{VERSIONNUMBER} is optional in query string. In the past I…
B3nny
  • 13
  • 3
1
vote
1 answer

Nginx: After removing .html suffixes, how to redirect all requests to the new URLs?

I want to optimize the link structure of an older Magento shop system. Until now, when generating the static pages, a .html suffix was added to the corresponding path. Due to an earlier problem, paths with double suffixes even existed (e.g.…
max stern
  • 13
  • 3
0
votes
1 answer

Server Rewrites No Longer Works

I have been using the server commands below in my .htaccess file for months without any problems, but yesterday, out-of-the-blue, whenever I attempted to navigate from the website homepage to other pages, or attempted to navigate through the Magento…
Krang
  • 1
  • 1
0
votes
1 answer

htaccess - .htaccess in sub directory not inheriting .htaccess in root directory

i have 2 .htaccess files first in /public_html/ #ErrorDocument 404 https://example.com/en/404.php RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://example.com/$1 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond…
0
votes
0 answers

Apache mod_rewrite order not working as expected

I want to respond with 404 for /autodiscover/ on https://mycompany.com as this is the URL Outlook (and other clients using Exchange autodiscover) checks at startup. What this vHost also does is redirecting everything else from https://mycompany.com…
koffik
  • 1
  • 1
0
votes
1 answer

apache2 append www to https url

I have an apache2 webserver in AWS using bitnami. In my bitnami.conf file I need to rewrite all URLs to https://www.example.com I am able to redirect the following correctly mydomain.com http://example.com www.example.com But when the url is…
0
votes
2 answers

Why doesn't this .htaccess file redirect properly?

I have a web application with multiple pages. The .htaccess file redirects everything after the domain-name.com/ to my index.php file, which processes the input and renders the appropriate page. However, I also have some actual directories under…
Ryan Griggs
  • 963
  • 2
  • 14
  • 29
0
votes
1 answer

Rewrite cond for domain and www.domain letsencrypt

I have this virtualhost in /etc/apache2/sites-available/cv.conf ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/cv/web AllowOverride All Order…
onda47
  • 103
  • 1
  • 4
1 2 3
8 9