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 ...


4

better alternatives like Apache Virtualhosts or something. If you have access to the server-config, then you can use the Alias directive in the vHost to route all requests for /content/images to /wp-content/images. For example: Alias "/content/images/" "/wp-content/images" Now, a request for /content/images/example.jpg would be sent to /wp-content/images/...


4

You just need to implement your more specific redirect first, before your "generic" redirect everything else directive. For example: RewriteCond %{HTTP_HOST} example\.net$ [NC] RewriteRule ^en$ https://example.com/abc [L,R=301] RewriteCond %{HTTP_HOST} example\.net$ [NC] RewriteRule ^ https://example.com%{REQUEST_URI} [L,R=301] Aside... RewriteCond %{...


3

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteCond %{REQUEST_URI} !exclude RewriteRule ^(.*) http://subdomain.example.com/$1 [L,R=301] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &...


3

example.com/index.php/somefolder/anotherfolder/file/query... Everything after the file index.php in the URL is called "additional pathname information" (or path-info for short). Whether this is valid on the URL is, by default, dependent on the file handler - in this case the PHP handler. And the PHP handler allows path-info. This information is available in ...


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

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

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!


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

Found the solution through .htaccess Never sure if it's the best, but it works: RewriteRule ^([_0-9a-zA-Z-]+/)?content/(.*) /wp-content/$2 [QSA,L]


2

You just need to add any rules that target specific URLs before your more generalised redirect. Also note that, generally, you should deliver a 404 with an internal subrequest, not an external "redirect" (as you describe). So, if you want to return a specific 404 message, you should also define a custom error document with the ErrorDocument directive. For ...


2

Try the following at the top of your .htaccess file: RewriteRule (.*)-2/$ /$1/ [R=301,L] Any URL that ends in -2/ is redirected to the same URL without -2. The $1 (in the substitution string) is a backreference to the captured group (the part before the -2/) in the RewriteRule pattern.


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 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

From your directives I assume you are working directly in the main server config or <VirtualHost> container (as opposed to a <Directory> or .htaccess context). no restrictions on the path , it can have any number of segments This slightly complicates matters as there is no "simple" way to replace arbitrary characters in the URL without using ...


2

RewriteRule ^/namedeal/([a-z][a-z])_domain_name\.php$ /namedeal/cheap_domain_name.php [R=301,L] In .htaccess the URL-path matched by the RewriteRule pattern does not start with a slash, so this should be: ^namedeal/[a-z][a-z]_domain_name\.php$ No need for the capturing subpattern (ie. remove the parentheses). Aside: If _domain_name.php is the same in ...


2

So if you wish to redirect your URLs from subdomain www.example.com containing an exact query string to a new subdomain wa.example.com with the same query. This htaccess will do the job: RewriteEngine On RewriteCond %{QUERY_STRING} (^|&)location=western-australia RewriteRule ^(.*)$ https://wa.example.com%{REQUEST_URI} [R=301,NC,L,QSA]


2

RewriteRule "^//(.*)" "/$1" [R=301,L] This will never match because the URL-path that the RewriteRule pattern matches against has already had all instances of multiple slashes reduced to a single slash. To redirect such requests you can make use of this "feature" and simply redirect "to itself" and check against ...


1

There are actually several places in the code you've posted that could trigger a "500 error" (or rewrite-loop), depending on the URL being requested (which you've not stated) and the filesystem structure (which you've not stated). However, the following directive is your most immediate concern: RewriteRule . /post.php This will result in a ...


1

I don't think that you actually want a redirect. A redirect puts an ugly port number into the URL visible to the client. It would be more desirable to use a reverse proxy it most cases. A reverse proxy has your main server connect to your backend API port, get the content and relay it back to the client without the client ever knowing about the backend ...


1

Redirect / /dali Ordinarily, this directive would result in a redirect loop*1 for URLs other than /api/<something> (since the mod_rewrite directive that follows takes priority), which leads me to think you don't have .htaccess overrides enabled to begin with (ie. .htaccess is not enabled)? (*1 Unless perhaps you have another .htaccess file in a ...


1

RewriteRule ^/contact/?view=full$ /contact/ [R=301,L] The RewriteRule pattern matches against the URL-path only, which notably excludes the query string. So, the above directive won't match the required URL. To match the query string you need to use an additional condition and check against the QUERY_STRING server variable. Also, in .htaccess (directory ...


1

RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /fr/index.html [L] Aside: If you removed the RewriteBase directive and the /fr/ prefix on the RewriteRule substitution then all your .htaccess files in the locale subdirectories would be the same. However, I would go ...


1

I expect www.filmstore.sandwiches.org to go to sandwiches.org, ... This does not work, but sends me to filmstore.net, which I think is the default behaviour for multiple cPanel domains. Ah, but the "problem" here is that the www.filmstore subdomain maps to the /filmstore subdirectory off the main domains document root (as stated in comments) - this ...


1

RewriteCond %{REQUEST_FILENAME} !^/PhP/?$ RewriteCond %{REQUEST_FILENAME} !^/forms/?$ RewriteCond %{REQUEST_URI} !^/PhP/?$ RewriteCond %{REQUEST_URI} !^/forms/?$ You don't need to check against both REQUEST_FILENAME and REQUEST_URI - you're just repeating the same check. It's easier to use REQUEST_URI (the URL-path) in this instance. The ...


1

It sounds like you may have put the directives in the wrong place in your .htaccess file. The HTTP to HTTPS redirect needs to go near the top, before any other rewrites. The nature of your URLs suggest you are using a front-controller type pattern and rewriting requests to a common script. However, the "homepage" does not need to be rewritten (since mod_dir ...


1

It would seem "the problem" is in your PHP code, not .htaccess as you seem to suggest. RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] All requests are rewritten to index.php (your "front-controller") which then routes your URLs. It is this PHP script that determines whether /login or /login/asdasdasd, etc. resolve to a valid page on your ...


1

If you are "redirecting" old URLs then you should implement an external redirect, not an internal rewrite, as you have done here. (listing?holidaytype=Villa is unlikely to be a valid filesystem path - but that's possibly another issue.) For example, try the following instead: RewriteCond %{QUERY_STRING} ^proptype=Villa&action=search$ RewriteRule ^index\...


1

# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Additional rewrite rules go here RewriteRule ^[0-9]{4}/[0-9]{2}/(.*)$ /$1 [R=301,L] : Any custom mod_rewrite directives, such as your "redirect" should go before the # BEGIN WordPress section. You should avoid editing between the WordPress comment markers as WP itself tries ...


1

OK. So after having spelled out the question and posted it, I finally found the solution in this blog post. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Additional rewrite rules go here **RewriteRule ^[0-9]{4}/[0-9]{2}/(.*)$ /$1 [R=301,L]** RewriteRule ^index\.php$ - [L] RewriteCond %{...


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