mod-rewrite

Force video/webm mime type using .htaccess based on request uri

懵懂的女人 提交于 2019-12-22 04:12:13
问题 I have a rewrite rule in .htaccess RewriteRule (.+?\.fid)/ /$1 [L] with a request URI like: /123.fid/myfile.webm How can I force the mime type to: video/webm using .htaccess including the rule above? What I have attempted already, to add on TOP of the .htaccess file without success: AddType video/webm .webm and <FilesMatch "\.webm$"> ForceType video/webm </FilesMatch> I use apaches mime_magic module to look up mime type of .fid files, but this doesn't apply to webm files. I'm assuming it's

mod_rewrite rule and setenv

烂漫一生 提交于 2019-12-22 03:49:09
问题 Is there anyway to use the value set in a SetEnv on the RewriteRule statement? Example: SetEnv MY_SCRIPT myScript.php rewriteEngine on RewriteRule ^(.*)$ %{MY_SCRIPT} [L] 回答1: According to http://httpd.apache.org/docs/2.0/env.html the SetEnv is called after the RewriteRule. Therefore it seems to be impossible to use any variable set via SetEnv in a RewriteRule- or RewriteCond-statement. Using SetEnvIf on the other hand is called before the RewriteRule and therefore Variables set there can be

Using htaccess to pass directories to GET parameters Without rewriting url

老子叫甜甜 提交于 2019-12-22 01:36:34
问题 I would like to pass (not redirect) something like this: http://www.example.com/ (with / optional) passed to the script http://www.example.com/index.php http://www.example.com/foo/ (with / optional) passed to the script http://www.example.com/index.php?nav=foo http://www.example.com/foo/bar (with / optional) passed to the script http://www.example.com/index.php?nav=foo&subnav=bar Furthermore I would like to pass the subdomain http://testumgebung.example.com to http://www.example.com

Pretty URL's for web application

↘锁芯ラ 提交于 2019-12-22 00:16:48
问题 I'm aware that there are a hundred articles, tutorials and manuals on Mod Rewrite but i tend to learn better by examples, so all i'm asking is for a quick pretty url conversion and i'll be on my way (so i can dissect exactly what its doing, so i can apply it to others) I have this URL: http://www.example.com/single.php?id=1 Now it would be great if it could follow the same convention as Stack Overflow where the id=1 is the actual title of the page. I have the title in a PHP variable if thats

Lighttpd configuration, . (dots) in my query string cause 404

房东的猫 提交于 2019-12-21 23:47:18
问题 I have an address on my site like so: http://www.example.com/lookup?q=http%3A%2F%2Fgigaom.com%2F2010%2F10%2F10%2Fangry-birds-for-windows7-phone-dont-count-on-it%2F In this example, the dot in the 'gigaom.com' part of the query string is screwing with lighttpd and my rewrite rules. I get a 404 with the dot in, no 404 if I take the dot out. My rewrite rules are below. In case it makes a difference, I'm using symfony 1.4. If anyone could shed some light on this problem it would be much

Why does htaccess RewriteRule ^foo$ also match ^foobar$

纵然是瞬间 提交于 2019-12-21 23:32:47
问题 I want these URL redirects / forwards: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/c/d I have these two .htaccess RewriteRule lines: RewriteRule ^foo$ http://there.com/a/b [R=301,L] RewriteRule ^foobar$ http://there.com/c/d [R=301,L] But the result is: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/a/b foo is also matching foobar How do I make it work? 回答1: This was a browser caching issue. I initially had the rules wrong. I changed the rules to those listed

How do I make Apache know which app directory to use for different domains?

↘锁芯ラ 提交于 2019-12-21 23:22:01
问题 I'm trying to create a site with CodeIgniter. I will have multiple domains served from this server, and what I am trying to do is to separate the HTTP requests for www.example1.com from the ones for www.example2.com and then redirect them to the their correct application folders. Say this is my directory structure: system application example1 example2 So this request www.example1.com/gallery/ would then be redirected to exmaple1 folder. Does anyone have any code example for doing this?

URL rewrite PHP $_GET variable

喜你入骨 提交于 2019-12-21 22:48:21
问题 Hey, I am looking to make a .htaccess rewrite file to change: newProject/index.php?start=2 to newProject/page/2 How might I go about this? Thanks! 回答1: I think your question is backwards, especially if you are looking for cleaner URLs. RewriteEngine On RewriteRule ^newProject/page/(\d+)$ /newProject/index.php?start=$1 I assume that your users will click on URLs like /newProject/page/2 , and a PHP script at newProject/index.php will access $_GET['start'] to read the page number. 回答2: If you're

CodeIgniter .htaccess index.php rewrite not working on user directory

安稳与你 提交于 2019-12-21 22:16:51
问题 I have a little problem with codeigniter, I have a .htaccess for rewrite the index.php it works great if I put my projects on /var/www or if I make a virtual host for it. But I want to use my user directory such as http://localhost/~userdir/myproject. If I use my user directory when I'm trying to do request to a controller like: http://localhost/~userdir/myproject/signup I get this error: Not Found The requested URL /index.php was not found on this server. This is my current configuration:

How to make a catch-all handler in an .htaccess file?

房东的猫 提交于 2019-12-21 22:04:10
问题 I want to create a rule at the end of an .htaccess file that catches everything that failed to match up until then. How can I do that? P.S. I've already tried everything :) Actually, I haven't, but it sure seems like it! Update: Some people are replying with RewriteRule ^.*$ or an equivalent. This does not work! It will match everything including the other 'good' URLs. 回答1: There are actually some good answers here already, but you have responded with... But then this matches everything