.htaccess

File with a short URL downloaded with original filename

久未见 提交于 2021-01-29 18:02:01
问题 Question ( see below for longer explanations and things I have tried already ) : Is there a way of having the short URL http://example.com/qf56p9z redirect to the first file found on the server of the form /files/qf56p9z_(.*) , and having it downloaded on the client with filename = (.*) ? (if possible, without PHP) Background : I have a file on server stored in /files/qf56p9z_blahblah.xls that I would like to be accessible from this short URL : http://example.com/qf56p9z (+the same for other

How to replace certain URLs with .htaccess

会有一股神秘感。 提交于 2021-01-29 17:20:39
问题 I have a website with URLs like this: www.website.com/user/page/someName1 www.website.com/user/page/someName2 www.website.com/user/page/someName3 How can I remove or hide /user/page with .htaccess to end up with this: www.website.com/someName1 www.website.com/someName2 www.website.com/someName3 回答1: You can use: RewriteEngine On RewriteCond %{THE_REQUEST} \s/+user/page/(\S+) [NC] RewriteRule ^ /%1 [R=301,L] RewriteRule ^user/page/(.+)$ /$1 [L,NC] 来源: https://stackoverflow.com/questions

WordPress htaccess redirect wild redirect

大城市里の小女人 提交于 2021-01-29 11:02:53
问题 I am using WordPress WooCommerce. My product links are like this: http://example.com/product/tshirt123 How do I code the htaccess so my links will be redirected to http://example2.com/product/tshirt123 ? Currently I have this code below in my htaccess but it doesn't redirect http://example.com/product/tshirt123 to http://example2.com/product/tshirt123 . RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^product\/?(.*)$ "http\:\/\/example2\

The new parameter FB adds to external links (fbclid)

左心房为你撑大大i 提交于 2021-01-29 09:53:10
问题 As indicated in a similar recent question, in order to have my WordPress blog remove automatically the parameter fbclid=xxxxxxxxx added by FB to all the links pointing to my blog, I inserted the following code to my .htaccess file, in the root of my domain: RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} "fbclid=" [NC] RewriteRule (.*) /$1? [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] The result is that who clicks

Add trailing slashes in WordPress Multisite without damaging the admin interface or the JSON API

六月ゝ 毕业季﹏ 提交于 2021-01-29 07:27:31
问题 For a WordPress multisite installation I am having the following part of my .htaccess: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^.]+)([^./])$ %{REQUEST_URI}/ [L,R=301,NE] In a single WordPress installation where /wp-admin and /wp-json always follow directly after the domain I can exclude those from the trailing slash rule with this: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/wp-admin

.htaccess redirect from IP adress to actual domain

半城伤御伤魂 提交于 2021-01-29 06:06:24
问题 How do I redirect IP to actual domain? For example: 123.45.678.901 to www.example.com and all subfolders and subpages like 123.45.678.901/all-pages to www.example.com/all-pages Also, my SearchConsole also recognizes "top linking sites" for the same IP but in this manner: IP 123.45.678 ---------------------------- 38,132 LINKS IP 123.45.678.901 ------------------------- 3,617 LINKS So I probably should redirect 123.45.678 as well. Is that possible and how? One more thing - IP opens in HTTP and

Ignore the empty folder (403) and pass the URI to the Laravel controller with .htaccess

送分小仙女□ 提交于 2021-01-29 05:02:05
问题 I have a project with Laravel and inside the public folder ( httpdocs ) I have a folder /en/news , all works fine with the route /en/news but when I try to go to the /en I have a 403 error because it is a empty folder, the real problem there is that /en is a route in my Laravel project with the homepage of the web, so first executes de .htaccess and throw the 403. Is there any way to ignore this error for this specific folder/route ( /en ) or something like that? My .htaccess is the tipical

Ignore the empty folder (403) and pass the URI to the Laravel controller with .htaccess

让人想犯罪 __ 提交于 2021-01-29 04:52:55
问题 I have a project with Laravel and inside the public folder ( httpdocs ) I have a folder /en/news , all works fine with the route /en/news but when I try to go to the /en I have a 403 error because it is a empty folder, the real problem there is that /en is a route in my Laravel project with the homepage of the web, so first executes de .htaccess and throw the 403. Is there any way to ignore this error for this specific folder/route ( /en ) or something like that? My .htaccess is the tipical

4mb image file upload gives HTTP 413 error when uploading to production server

自古美人都是妖i 提交于 2021-01-29 04:32:35
问题 I'm trying to upload an image from the client to a server for processing and then on to an S3 AWS bucket. It works great on a local server but not on a live server. XMLHttpRequest cannot load https://api.parthenon-click.com/img_upload/cover. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.parthenon-click.com' is therefore not allowed access. The response had HTTP status code 413. I'm using ElasticBeanstalk PHP v5.4 for client server and Node

Remove exact string from end of url apache htaccess rewriterule

心已入冬 提交于 2021-01-29 04:08:34
问题 I have all my URLs like this example: http://domain.com/="%7b%7bstore I would like to create a RewriteRule to remove the trailing ="%7b%7bstore from the url. The string is always at the end. The rule has to leave any other query string, url part untouched. I figured that %7b translates to { . I got this far with the rule, but can't figure out the rest: RewriteRule ^/?(.*)store$ /$1 [L,R=301] Could anybody help? Thank you! 回答1: You can use this rule as your first rule in root .htaccess: