.htaccess

XAMPP .htaccess AddEncoding

穿精又带淫゛_ 提交于 2020-06-29 03:48:16
问题 I install no my MacOs HighSierra fresh XAMPP (osx-7.4.6-0-vm) and start it - server runs on IP 192.168.64.2 . Then I mount /opt/lampp and click to Explore . The Finder window open and I go to directory htdocs/ . Then inside htdocs I create folder assets and inside it I copy file alice.wasm (this file is compressed using brotli (br)). You can download this test (brotli compressed) file using this jsfiddle generator. Inside htdocs I create following .htaccess file <IfModule mod_mime.c> AddType

How do I undo the effects of a 301 permanent redirect, and get the domain to point at the original subdomain again?

丶灬走出姿态 提交于 2020-06-29 03:33:15
问题 I've made a grave error, and I cannot seem to undo it! A customer all the sudden wanted a website (that was on hold) to go online asap. Easy problem to solve, I just remove the redirect in cPanel. Or so I thought... Then I saw, that the redirect for that particular site was a 301 permanent redirect, to a generic 404 site on another domain. Note: We have a reseller solution, and host several sites as subdomains in the same cPanel. I deleted the redirect in cPanel, but the site still redirects

.htaccess URL rewrite (remove folder from URL)

喜你入骨 提交于 2020-06-28 05:48:06
问题 Trying to show quarantine.country/coronavirus/dashboard/usa/ instead of quarantine.country/coronavirus/dashboard/region/usa/ at our covid-19 dashboard for US, using @anubhava's solution: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase /coronavirus/dashboard/ RewriteRule ^region/(.*)$ /$1 [L,NC,R] please let me know why the solution above doesn's seem to have the desired rewrite. Thank you! 回答1: You may use these rules in /coronavirus/dashboard/.htaccess

htaccess redirect to base URL if URL contains parameter

耗尽温柔 提交于 2020-06-28 04:56:16
问题 I need to redirect all url's that contain the parameter ?lang= to my base url. For example: If www.example.com/?lang=ru redirect to www.example.com . I have tried with RedirectMatch but it's not working. Thanks!!! 回答1: The Redirect* directives do not handle the query string so you need to use URL rewriting instead. RewriteEngine on # if the query string contains a parameter called "lang" RewriteCond %{QUERY_STRING} (?:^|&)lang= # then redirect (permanently) to / RewriteRule ^ / [L,R=permanent

Merge two .htaccess files from two projects into one

江枫思渺然 提交于 2020-06-28 03:45:21
问题 I have a project which I have to include within a project. So .. project A is a web site built on top of custom framework which uses this .htaccess rewrite rules: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [PT,L] The second project B is built on top of another custom framework and I am supposed to make it look like a subfolder to the first one. So I placed project B inside a folder "subfolder". Project B has its own .htaccess

302 redirect url with parameters

强颜欢笑 提交于 2020-06-28 03:35:31
问题 In htaccess file the following works redirect 302 /old.php http://somesite.com/new.php but following fails redirect 302 /old.php?this=that http://somesite.com/new.php I think it's because the second version contains a query string. How can we redirect URLs like that? Please note the destination URL format is different so it cannot be an automated rule, so I need to write the custom URLs that users will be redirected to. I found a similar question with replies here, but the proposed solutions

htaccess SetEnv REDIRECT_ prefix

家住魔仙堡 提交于 2020-06-27 18:19:08
问题 I'm setting an environment variable in an htaccess file and it's being prepended with "REDIRECT_". As far as I've read, this is caused by URL rewriting.. the thing is, I'm not doing any rewriting (that I'm aware of). My webspace contains two files: .htaccess SetEnv Foo "bar" index.php <?php print_r($_ENV); Now, I'm guessing this may have something to do with the fact that this is on a shared hosting package with 1&1.. is there anything else I should be checking or has anyone experienced this

How to use SetEnvIf with Request_URI when it is rewritten to index.php?

天大地大妈咪最大 提交于 2020-06-27 17:24:09
问题 We have a drupal website a.com that is password protected. I want all a.com/api/... URIs not to be, though. So I've read about SetEnvIf : AuthName "Stage" AuthType Basic AuthUserFile ~/.htpasswd SetEnvIf Request_URI ".*data_sheets.*\.pdf" noauth SetEnvIf Request_URI "/api/.+" noauth SetEnvIfNoCase Request_Method OPTIONS noauth Order Deny,Allow Deny from all Require valid-user Allow from env=noauth Satisfy Any The /api/foobar URIs are still asking for a password though. Since it's a Drupal

What does the =$1 mean in url rewriting?

江枫思渺然 提交于 2020-06-26 14:49:09
问题 I can't find any information on stackoverflow or google about the meaning of =$1 . I get superficial information but nothing for beginners like me. What does it do? If I have something like this: www.website.com/profile.php?simon Does the name simon correspond to the $1 variable and why 1 ? This is how I understand it: (.*) profile/profile.php? id=$1 The bold corresponds to: www.website.com/profile.php? id=simon Converted with rewrite it becomes: www.website.com/profile/simon Am I missing

Apache redirect all to index.php except for existing files and folders

半城伤御伤魂 提交于 2020-06-25 07:40:33
问题 I have index.php that reads full path by $_SERVER[‘REQUEST_URI’] variable. My task is when user enter: www.domain/resource/777 redirect to index.php with path /resource/777 and parse $_SERVER[‘REQUEST_URI’] to do some logic. But I have also real files and folders like: css/theme.css assets/assets.js resource/locale.js When I try this config: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php [L] Client could not get all css