mod-rewrite

Maintenance page forwarding with htaccess does not work for proxied material

末鹿安然 提交于 2020-01-15 06:55:26
问题 I have scoured the internet and am at a loss as to why my maintenance page redirect and rewrite rules do not work for any proxied material or anything that is coming across through https. I am using an Apache 2.2.3 server with tomcat 6.0.24 installed on it. I have the following htaccess file: Options +FollowSymlinks RewriteCond %{REQUEST_URI} !/maintenance.html RewriteCond %{REQUEST_URI} !/images/(.*)$ RewriteCond %{REQUEST_URI} !/scripts/(.*)$ RewriteCond %{REQUEST_URI} !/styles/(.*)$

Strip down any parameter from URL which is not whitelisted

若如初见. 提交于 2020-01-15 06:24:47
问题 I need to strip any parameter which is not in white list e.g. URL: abc.com/somePage?phone=1234&stipAway=asd&fax=324&stripDown=disappear&zip=zip should look: abc.com/somePage?phone=1234&fax=324&zip=zip Related question: Rewrite URL using .htaccess file in case there is used parameters which is not in white list P.S. It is more complex solution needed that in first two answers mentioned. To make understandable I will illustrate with some more examples: abc.com/somePage2?stripAway=asd&fax=324

mod_rewrite: Redirect if anything but a file

扶醉桌前 提交于 2020-01-15 06:20:07
问题 I have an Apache .htaccess file in the parent directory to directory this .htaccess file is currently located. This works perfectly redirecting all requests as required. However, I would like it so in this directory, if the request is for a valid file (and NOT a directory), ignore the main rewrite rule. Currently, the following turns off the rewrite for directories as well, and I can't figure out why. <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On

Apache - Can I make a proxy server with just Apache?

眉间皱痕 提交于 2020-01-15 04:28:26
问题 I have a bunch of subdomains in one single server: a.example.com b.example.com news.example.com All of them are in the same Apache virtualhost. I need to use a feed provided by the news subdomain inside the a and b subdomain. The feeds typically look like this: news.example.com/news/a news.example.com/news/b On the a and b subdomains, I'm using jquery's ajax function to load the data from the news feeds, and present it on a and b. This initially didn't work, because of the same-origin policy.

Apache mod Rewrite: how to rewrite these URLs to make clean URL

一世执手 提交于 2020-01-15 03:40:28
问题 I'm trying do following rewrite from last two days. Force to use www.example.com - done Hide PHP extension - done but not sure that it's a good way 404 error to custom page - done Now my main problem is 4. Host all page on root(/) I have following files: news.php search.php store.php allstores.php Client requests like this: Type 1: http://www.example.com/news Type 2: http://www.example.com/search?q=term Type 3: http://www.example.com/allstores/H Type 4: http://www.example.com/myname I want to

Use htaccess to validate with php before granting access to a directory

纵饮孤独 提交于 2020-01-14 19:09:06
问题 I'm working on an app where users can create an account and upload images, which get stored in a directory and can then be displayed within the application itself or in a publicly visible part of the app. Now I'd really like to protect the images to ONLY allow access to these images in the event that certain conditions are met, i.e, a session is set or the permissions in the db for the image are set to public, to name a few. So, what I'd need is that whenever an image from that directory is

Apache “File not found.” instead of 404. error document

倖福魔咒の 提交于 2020-01-14 14:33:08
问题 I want to set a custom 404 error document, but I have a problem with it! First, I have two RewriteRules in my .htaccess: RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ /$2/$3.php?lang=$1 [L] RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/?$ /$2/$3/$4.php?lang=$1 [L] So my URL looks like: /de-de/page/other/stuff and opend /page/other/stuff.php?lang=de-de Now it's time to set my own error document: ErrorDocument 404 /404.php If there is a mistake in "/de-de/page/other/" for example " /de-de/wrong

How to install laravel app in subfolder of shared host?

旧城冷巷雨未停 提交于 2020-01-14 14:10:40
问题 I install laravel app in root of my shared host "public_html now I want to install Russian version of this app in ru/ subfolder but when I go to example.com/ru I got 404 Page not found error. I use apache web server my .htaccess file in root folder contain these code <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> how should i change this configuration? Thanks. 回答1: You will do it in the same way you installed it in the root directory. I will tell you

How to install laravel app in subfolder of shared host?

故事扮演 提交于 2020-01-14 14:09:19
问题 I install laravel app in root of my shared host "public_html now I want to install Russian version of this app in ru/ subfolder but when I go to example.com/ru I got 404 Page not found error. I use apache web server my .htaccess file in root folder contain these code <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> how should i change this configuration? Thanks. 回答1: You will do it in the same way you installed it in the root directory. I will tell you

Prevent executing .htaccess of parent folder

余生长醉 提交于 2020-01-14 10:28:10
问题 I have two different sites on same domain for example: First site in the root directory http://example.com/ Second site in subfolder http://example.com/site2/ Each site have his own .htaccess When i enter to second site ( http://example.com/site2/ ), in log of mod_rewrite i see that apache trying to execute .htaccess of first site ( http://example.com/ ). So, the question is how to prevent this? Thanks 回答1: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions inherit This