Questions tagged [rewritecond]

128 questions
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,…
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
  • 133
  • 9
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
  • 885
  • 2
  • 12
  • 27
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
0
votes
1 answer

Add www to domain but not for a specific domain

I've the following code in my .htaccess file: RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] The code above is for adding www to the domain if it does not have the www. But I have a domain like:…
Igor
  • 125
  • 7
0
votes
0 answers

nginx display image404.php if image not found

Having to move a .httacess into nginx version: nginx/1.11.2, most of it with success but one rewrite is still troubling me. ##Return default placeholder image when image file on server not found RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}…
Joakim
  • 39
  • 2
  • 7
0
votes
1 answer

apache2 rewrite rule: delete any path from URL

I'm going crazy with a Rewrite Rule on Apache. Basically what I want to achieve is to rewrite any url like: http[s]://www.example.com/something to https://www.example.com I have a VHost on apache like the following: ServerName…
cloud81
  • 163
  • 1
  • 2
  • 8
1 2 3
8 9