.htaccess

301 Redirect except for one person using .htaccess?

I recently migrated a WordPress site to a new server and new domain name. To redirect traffic from the old site to the new, I put in place a simple one-line .htaccess file: Redirect 301 / http://www.newsite.com/ Now, however, the client wants access to the old site. Is there a way that I can let one person in and redirect everyone else...

urlencoded Forward slash is breaking URL

About the system I have URLs of this format in my project:- http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0 Where keyword/class pair means search with "class" keyword. I have a common index.php file which executes for every module in the project. There is only a rewrite ...

URL Rewrite language querystring

I want to re-write url using .htaccess I am new to it have created a site which is multi language. I want my url and all directories or files under it to have a lang=en variable in it while url looks like. site.com/en/ should be presenting http://site.com/?lang=en or site.com/en/test1/?test=1 should be like: site.com/test1/?test...

Multiple domains pointing to the same folder

Hello, I am currently running two websites. I am able to add my domains and set the root folder to / instead of /domain1.com and /domain2.com. That way both websites go to the same folder, however they both maintain their domain names (no redirects). My code determines whether the user is from domain1.com or domain2.com and displays the...

filename encoding on server

Hi Folks, another encoding question. On my server, I want to have the possibility of having mp3-files with utf-encoded filenames, for exampe Начало.mp3 . Now when I save (or rename via my FTP client) a file to Начало.mp3, after refreshing, this file will automatically be renamed to ??????.mp3. I added a htaccess to both the parent an...

Need to redirect all traffic to https

I want to redirect any traffic that goes to http://example.com to https://example.com same for http://example.com/about to https://example.com/about I thought it would be something like this: RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] ...

mod_rewrite: redirect top level directories to a file

I'd like to redirect all top level directories to a file using mod_rewrite. So the following should redirect there: - http://example.com/test - http://example.com/test8/ - http://example.com/test_9231/ The following should NOT redirect there: - http://example.com/test.php - http://example.com/test_9231/test/ - http://example.com/t...

use htaccess to rewrite subfolder in drupal

So there is a drupal installation with a subfolder with kohana 3 in it. Trying to redirect the URL to something much more clean RewriteRule ^newpage$ /registered_affiliates/index.php/affiliates/splash Thanks ...

Apache mod_rewrite: can these simple RewriteRule be improved? And suggestions!

Hello, I started finally to understand Apache mod_rewrite. It's pretty GREAT! Plz have a look at the followings: 1) Permanent redirects "http://www.domain.com/folder_name/" (with or without final slash and with or without the 'www') to "http://www.domain.com/some/path/some_page.html" RewriteRule ^folder_name[/]*$ "http\:\/\/domain\...

Remove part of URL

Hello, i have a url like this http://example.com/blog/photos/photos/gallery/image/1. And i need to remove the second photos folder. How do i remove the part using mod_rewrite and .htaccess? For your interest /blog is my document root. Thanks a lot for any suggestions, Steve EDIT You should know that the URLs being generated by Word...

htaccess rewrite problem

RewriteRule ^a/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)$ /var/www/vhosts/mydomin.com/httpdocs/search.php?searchtext=$1&locationtext=$2&page=$3 [QSA] I want to pass http://www.mydomain.com/searchtext=jobs&locationtext=A.G.sBosRoad&page=1, but I'm getting an error. I'm guessing this error is due to the . characters. Wh...

Regular Expression For URL Query

I've been using mod_rewrite in my htaccess file to rewrite my urls and I've run into a problem when doing pagination. Here's the url for my page: http://domain.com/concerts/features/folk-roots?page=2 htaccess file: RewriteRule ^features/([^/]*)?page=([0-9]*)$ featureCat.php?cat=$1&page=$2 [NC,L] It works fine without the page query,...

Default Page Display in Address Bar using .htaccess

Hi Guys, I wanted a htaccess file which would set the Default page for a directory and also display the file name in the address bar. For example: In general, if index.html is the Index file, then typing the address http://www.example.com/ would be internally loading http://www.example.com/index.html but by default the /index.html is...

htacces proxy rewrite howto

Hi, I have a bit of a problem. I have 4 domains: www.myurl.com, myurl.com, www.myurl.de, myurl.de. Now my ajax posts only work on www.myurl.com. I would like to send all requests to this url without changing the url in de adress bar. This is done by a proxy rewrite(?) but I can't manage to get this fixed and I need some help ... I wou...

Using mod_write to redirect domains in URL to php script

I am trying to use mod_rewrite to redirect a domain in the site URL to a php script. For example: http://example.com/http://somedomain.com should redirect to: http://example.com/test.php?domain=http://somedomain.com I have tried to do this with the following RewriteRule RewriteEngine On RewriteRule ^(.*)$ /test.php?domain=$1 [L] ...

.htaccess for preventing direct access/linking to a folder

So I have this one folder that stores all the confidential excel files in it. I dont want people to be able to link/access to it directly, but I have a link on my web site that allows the enables authorized users to download their files from the data. This is what I have RewriteEngine on RewriteBase / RewriteCond %{HTTP_REFERER} !^$ R...

Safari PDF viewer does not recognize referrer?

My goal is to have user-uploaded files (mostly PDF) available for download only via a link from the host website. I've protected user-uploaded files with an .htaccess file that resides in the uploads directory. .htaccess checks the referrer against the hard-coded domain name, and if the referrer matches, it allows access. Otherwise ac...

Passing values to htaccess

i have a htaccess file for redirection the redirected content is RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$ RewriteRule ^(.*)$ /sitename/view.php?link=$1&action=photos&page=&1 [L,QSA] The page numer is dynamically passing from the page How we can get the page number here pls helpme ...

htaccess regex for number greater than 1?

I'm trying to create a rewrite rule to match data-2, data-3, data-4 etc. and send them to data.php?var=2. It needs to ignore data-1. RewriteRule ^data-([2-9])/?$ index.php?page=data&var=$1 [NC,L] The above rule works for numbers 2-9, but how can I make it so that it works for any number greater than 1? ...

How to configure in Apache an exception to password protection for a CakePhp App?

Hello, I have a CakePHP Application which I want to protect with a password. The tricky thing is, that all files/locations should be only accessible with a password EXCEPT one specific Address (a function withing a CakePHP-controller) The Address is like that: http://example.com/MyApp/MyController/MyFunction?MyParam=MyValue All...