4

tl;dr Alternatively, just rewrite to php/inwork.php and parse the PHP superglobal $_SERVER['REQUEST_URI'] instead, which already contains the URL-path and query string from the initial request. (Note that the $_SERVER['REQUEST_URI'] PHP variable is different to the REQUEST_URI Apache server variable, despite the name being the same.) The REQUEST_URI Apache ...


4

As @dan mentioned in comments, this is a regular expression ("regex" for short and often referred to as a "pattern" in Apache docs). Specifically, Apache uses the PCRE (Perl Compatible Regular Expressions) flavour of regex. The first argument to the RewriteRule directive is a regex that matches against the URL-path component of the requested URL. In ....


4

It is used by wp-cli, the command line interface for WordPress. The wp-cli.yml is where you set configuration values, related to your website, for wp-cli.php to use. https://make.wordpress.org/cli/handbook/config/ For example, to update "pretty links" from the command line (wp rewrite flush), the wp-cli.yml (or a config.yml) file is necessary for the ...


4

Ideally, this should be "fixed" in the backend code, as there appears to be two "bugs" here... The uploaded file should not be saved with a %-encoded filename. This is a URL-encoding, intended for transit, not a filesystem encoding. The generated link is not being correctly URL encoded. If the underlying filename is "URL encoded" then the generated link ...


3

RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] This is a "standard" HTTP to HTTPS redirect. If this is resulting in a redirect loop (assuming you've discounted your browser cache) then either you have a non-standard server config or you are behind an SSL proxy that manages your security certificate. Either way, ...


3

Why are there two sets of conditions and rules. Can they be combined into one set? These are two rules that serve two different purposes - they cannot be combined. Taking out the (unnecessary) ".well-known" conditions, we have: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] RewriteCond %{REQUEST_METHOD} ...


3

Try this: RewriteCond %{HTTPS} off RewriteRule ^(.*) https://example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]


3

If I try to go to /admin or /admin/ without specifying the filename I get this error: Because /admin/ is a directory and your directive only checks that the request does not map to file. So the conditions are satisfied and it redirects from /admin/ to /admin/.php (as per your RewriteRule). You need to add another condition that checks that the request does ...


3

RewriteRule ^([\w-]+)/([a-z0-9]+)/([a-z-0-9]+)$ index.php?p=$1&bay=$2&map=$3 [L] RewriteRule ^test/([\w-]+)/(\d+)$ index.php?page=$1&tab=$2 [L] You basically have a "conflict" with these two rules. These rules are processed in the order in which they appear in the file. Some of your URLs, that you are expecting to be processed by the second rule,...


3

Should I create a new .htaccess inside "companies" folder? No. In order to hide the /companies directory from the URL you are going to have to modify the .htaccess file in the parent directory. ie. the WordPress .htaccess file in the document root. There is CSS file and few images inside /companies So I assume you intend to remove /companies from all ...


2

This is really just an addendum to @Stephen's answer (which already appears to address the main problem). However, your directives could possibly be greatly simplified. If you are using the "same patterns" for each rule block and your hostnames are consistent, ie. host01.example.com maps to users-host01.example.com etc. (Although you have a slight ...


2

A RewriteCond only applies to the very next RewriteRule. It never applies to a RedirectMatch. Those are handled by mod_alias not by mod_rewrite. To get this to work you will need to repeat your RewriteCond for each rule and use a RewriteRule in place of RedirectMatch. RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?host1.example.com [NC] RewriteRule ...


2

This assumes you have already changed any internal links to use the "new" URL of the form /script/bla/1. (Otherwise, you will still be exposing the "old" URL containing the query string and create unnecessary redirects for users and duplicate requests to your site.) Part One External redirect from https://example.org/script.php?bla,1 to https://example.org/...


2

I think adding the http to https in there as well might be complicating things Yes, the above (generic) directives are both non-www to www and HTTP to HTTPS. With the way these directives are written you can't have one without the other. To exclude your dev domain from these directives - which will remove the www and HTTPS redirect from your dev domain ...


2

i have tried to give the index.php the parameter "page" Although you've not included this in the example you posted - so what you have posted will obviously not work because of this. If your front-controller is dependent on a page URL parameter then you need to pass this in the rewritten URL. For example: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{...


2

Another simpler method is to use redirects from mod_alias. A similar redirect directive from mod_alias is just one line. It doesn't require turning rewrite engine on. The syntax is pretty clear: Redirect permanent / https://www.example.com/ That means redirect the root of the website and all sub-URLs to the other website. Any additional path is ...


2

Because your rules conflict... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^\.]+)$ $1.php [NC] Your first rule matches a request of the form /username and rewrites this to username.php, before your second rule gets a chance to see the request. username.php does not match your second rule. One way to avoid this ...


2

Redirect 301 /page/page-a/ /page/page-b/ [R,L] On Apache this would have resulted in a 500 Internal Server Error because the [R,L] argument is not valid on a mod_alias Redirect directive. [R,L] are RewriteRule (mod_rewrite) flags. or it displays www.example.com/page/page-b/?type=page&id=page-a This is the result of a conflict between mod_alias (...


2

I read a lot of pages and thought I had a firm grasp on what to add to htaccess which was along the lines of... RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] Exactly what directives you need to use can depend on your server configuration. And to some extent personal preference (eg. whether ...


2

tl;dr You're HTTP to HTTPS redirect is in the wrong place. It needs to go near the start of the /clickandbuild/bebechan/.htaccess file, not at the end. (See below for further explanation.) There seems to be a lot of misinformation / confusion here... The host that takes care of my SSL just told me "The SSL that we provide with your contract only protect ...


2

I think you have two problems: You don't say your bye.php should redirect. Right now you have it specified as a rewrite rather than a redirect. You need to add [L,R] flags to it to get it to redirect. You don't need your slash rules at all anymore. Because you didn't specify "last" with the [L] flag, on your bye.php rule, the slash rules are also taking ...


2

Google Analytics provides a way to add a filename to any page path ending with a slash, in order to standardize data for pages that might be accessible with or without the filename. Look in Admin > View Settings for the Default Page field, right underneath time zone. An index.php in that field is your reason!


1

https://www.bybe.net/cloudflare-enforce-ssl-redirect-http-https/ has the full details. To redirect to HTTPS, you need add a "Page Rule" for http://*example.com/* with the "Always Use HTTPS" option from the settings. To redirect to www you need three "Page Rules": http://example.com/* -> https://www.example.com/$1 https://example.com/* -> https://www....


1

RewriteCond is by default evaluated with the [AND] operator, which means https://www.example.com/wiki/Links_Frequently_Requested/ is never true in your original example. Consider having two different rules to cover both alternatives, or use the [OR]-operator. Also, .htaccess works on a directory-level, so you should consider creating a separate htaccess-...


1

RewriteRule ^/findyourrep/ http://www.newexample.com/findyourname/ [NC,R=302,L] In .htaccess the URL-path matched by the RewriteRule pattern does not have a slash prefix, so the regex should be ^findyourrep/ instead. The pattern ^/findyourrep/ will simply fail to match. You also need to make sure this redirect goes before the WordPress front-controller, ...


1

You are close, but there are some errors: RewriteRule ^/.*$ .... In .htaccess, the URL-path matched by the RewriteRule pattern does not start with a slash, so this should be simply ^.*$ (or even just .* - since regex is greedy by default), not ^/.*$. By including the slash prefix, it will never match, so the directive does nothing. (You would need the ...


1

I tried to combine these rules It looks like you are literally trying to combine these rules into a single rule?! These are two very different things: Canonicalise the URL (ie. remove the www and redirect to HTTPS). (Although you stated you wanted to "leave www" - your examples and directives suggest the opposite.) Internally rewrite the request. As such ...


1

Try adding this line of code after RewriteEngine On: RewriteBase /


1

In isolation, the redirect directives themselves are OK, so there must be something else going on... Having looked at your .htaccess file as a whole, with the redirect directives in-place, I'm surprised your redirect directives are actually doing anything(?!), since you've put them in the wrong place at the end of the .htaccess file, after the WordPress ...


1

Alright time to answer my own question after a long day of 2 people staring at this problem and being astounded. As it turns out it was totally our fault, for someone in the land before the land before time (2013) had created a global configuration file which contained a most curious line: alias /javascript /usr/share/javascript One may make some curious ...


Only top voted, non community-wiki answers of a minimum length are eligible