.htaccess

htaccess - How to restrict to access from my home

I have a website on the internet that I only want to be accessible from my house. Could I have htaccess be restricted to the MAC address of my router? If not, are there any other options? I don't think I could use IP address because my ISP changes it all the time. ...

What is the correct mime-type for serving an iPhone .ipa file?

I'm trying to post .ipa files onto our apache web server for our beta testers to download. Currently I'm using the following line in .htaccess to serve the files: AddType application/octet-stream .ipa This works great in Safari and Firefox, but in IE the .ipa extension is removed and is instead replaced with .zip. So instead of MyApp...

.htaccess flat links url shorten

I have a domain owp.me and I want to use htaccess so that I can convert to following. http://owp.me/id?=0f49 to http://owp.me/0f49 The "id" will only accept A-Z, a-z, 0-9 How would I set up the rewrite the RewriteRule? Edit: I have found how to do http://owp.me/hi/0f49 Options +FollowSymlinks RewriteEngine on RewriteRule ^hi/([^/]+...

htaccess form submit auto redirect to clean url

i have a site site.com/?w=thisworks site.com/w/thisalsoworksmanually i got this to work via htaccess now i have a form... when it gets submitted i get site.com/?w=stuffsubmitted i'm trying to have it auto redirect to site.com/w/stuffsubmitted here is my htaccess that works RewriteEngine on RewriteRule ^w/([^/]+)/?$ /index.php?w=...

Using .htaccess to redirect only traffic to the root to a specific page

I have a site set up complete with an index, etc. I would like to redirect only traffic coming directly to www.example.com to www.example.com/foo.php. However, if a user tries to access www.example.com/index.php or any of the other existing pages directly, the request should return the appropriate page as normal. I can't seem to wrap ...

.htaccess: Check file existence after RewriteRule

If have some rules in my .htaccess: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l RewriteRule ^.*$ - [NC,L] RewriteRule ^assets/img(.*)/([a-zA-Z0-9-_\.]*)\.(.*)\.([a-z]{2,4})$ /assets/img$1/.$2.$4/$3.$4 [NC,L] This causes /assets/img/path/image.jpg > /assets/img/path/image.jpg The second rule: /assets/im...

block games ads

Hi guys, I would like to block in game ads for my registered users.. is there a way to block mochiads on my server? tried IP Deny, htaccess still no avail. thanks, Garv ...

allow/deny external request htaccess

I want to block Flash/SWF uploaded by my users from calling other domains(unless approved). I only want to block only a few domains in which I think is malicious. ...

.htaccess: non-www to www + extensionless urls + no index

I would have thought this would be better documented somewhere, but cannot find much information on the subject. Basically I'm using htaccess to instill 3 rules on the site i'm working on: Redirect / rewrite non-www to www Remove the extensions from each of the site pages - they're php files. Doing this means that the site index becom...

Managing multiple websites through a single controller

We developed some custom app here with CodeIgniter to help manage all of the domains we own (180+). The goal I have is to be able to create a single front-end controller on our master domain (lets say it's at /home/master/www). Lets say one of the sites i'm managing is called TestSite.com. This site is located at /home/testsite/www on...

php mobile redirect

I've managed to develop some code in php which would use a mobile template instead of the default one, however I'm not sure if I should redirect to a mobile URL (such as /mobile/) or if it's ok to just have the mobile template showing up instead of the default. Any thoughts on this? ...

How to target file with %20 in .htaccess?

Here is my .htaccess: ... rewriterule file%20name.htm http://mysite.com/new_name.htm#anchor [r=301,nc,ne] ... It's not redirected, and I believe this is because it's not targeting the file with the %20 in the name. As for the flags, I used ne to not rewrite the #anchor portion of the redirect. Also, the flag "nu" breaks my file and I...

rewrite rule in .htaccess: what does it do

What does this line in .htaccess do, and when would I need it? RewriteRule !.(js|css|ico|gif|jpg|png)$ index.php I'm working with zend and I noticed the .htaccess generated by zend doesn't have this rule, but I've seen a tutorial that has it without explaining why. RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond ...

how can I rewrite URL to fancy url?

Hi there, when my user logs in, I want the get variables that were sent rewrote onto the URL like so: http://mysite.com/mygetvar1/mygetvar_value1/mygetvar2/mygetvar_value2/ or mysite.com/mygetvar1=mygetvar_value1/mygetvar2=mygetvar_value2/ How can I do this? Please help! Thanks! ...

Help me write a Regex RewriteRule for htaccess

I need help writing a simple regex for RewriteRule for mod_rewrite in htaccess. So, here is what I am trying to accomplish: books/2010-the-world-by-hopkins-139_PPS-1234567 should go to index.php?pagename=mypage&PPS=1234567&description=2010-the-world-by-hopkins-139 So, in pseducode, the regex has to split the part after books by _ a...

Difference between three .htaccess expire rules

What's the difference between the following three .htaccess rules and when to use each, is there any special use cases that prefers one over the other?: Header set Cache-Control "max-age=290304000" Header set Expires "Thu, 15 Apr 2020 20:00:00 GMT" ExpiresDefault "access plus 10 years" ...

Restrict Image Access Codeigniter

I have an images dir at the root of my site. It includes images that should be public, in a public sub-directory, and images in a private directory that should only be available to logged in users. The problem is a logged-in user can copy the img URL, give it to a non-users and now they have access. I have an .htaccess file set up alrea...

php, url rewrite, how can I get a string from GET if the url doesn't have "?" ?

I would like to build a php website and I would like to remove all the strings that make the url to seem dynamic. However I still need to get information through GET so basically I don't know how to do that because I need to pass a parameter to $_GET request which obviously would be dynamic . For example I may have www.domain.com/mobile...

Search form parameter rewrite rule

I am realy ,realy newbie in rewrite rules.. I have php script with a search form and with three imputs : title ; category ; region . User can search by title category or region , so the parameters can not be in a specific order.Sometime they search by title sometime only by category an region... my rules RewriteRule ^list/(.*)/(.*)/(.*...

PEAR to send email from PHP script using a remote server with SMTP authentication

My php can't find mail.php I installed the PEAR package in a directory named pear_admin I secured everything in that directory with .htaccess and .htpasswd When I go to mysite.com/pear_admin/index.php it asks for my username and password. This works and I am able to see and use PEAR Package Management I installed the Mail package. I cr...