.htaccess

How can I write an .htaccess that will rewrite differently based on the request url?

I would like to have one .htaccess file that can rewrite correctly on both my localhost development environment and on my hosted production site. Right now I have to keep two separate file copies for every site I work on. I would like to be able to synchronize the two sites without blowing away either one of their .htaccess files. Belo...

Is it possible to use wildcards in the .htaccess file for mass moves?

I am reworking my website, going to be renaming a lot of directories, and need a simple way to write my .htaccess redirects for all of those pages. I am hoping for a solution that does not include a very long list of files. My .htaccess file is huge as it is. Thanks in advance! Lady Aleena ...

RewriteCond match for certain Query param/value pair

I have to do a redirect to another host if a certain parameter/value pair is in the querystring. So far I have RewriteCond %{REQUEST_URI}?%{QUERY_STRING} [&\?]abc=23&? RewriteRule ^(.*)$ http://anotherserver.com/$1 [R,NC,L] that works for /index.php?id=95&abc=23 and /index.php?abc=23&id=95 and /index.php?id=95&abc=23&bla=123 but ...

.htaccess rules with a subdomain and two domains

I have a domain domain.com that I use as my primary domain. I also own a second domain domain2.com that I have automatically go to domain.com This is done with .htaccess: RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule (.*) http://www.domain.com/$1 [L,R=301] I want to set up a subdomain sub.domain.com but with that curre...

Redirect subdomain request to subdirectory + https (using .htaccess)

Hi guys, I've got some issues with the .htaccess that I just can't get to work. Hope someone could solve this one. I have a SSL certificate on the www.-domain on an Apache server. I want all http://subdomain.domain.com requests on a specified list of subdomains to redirect to https://www.domain.com/subdomain. The second problem is, tha...

Modifying CakePHP-resident Wordpress Redirects using mod_rewrite

I have a CakePHP site that contains a vanilla Wordpress installation. It lives in /app/webroot/blog/. The problem I'm having is a strange one. I have the site configured, through mod rewrite, to redirect all requests to /app/webroot/blog to /blog/. The reason for this is that Wordpress was either throwing errors or displaying no cont...

Review my .htaccess I can't seem to make it work.

Hi Please review my .htaccess code below. The code below was suggested by I User here (Thanks for the code Gumbo), And I can't seem to make it work. RewriteCond %{THE_REQUEST} ^[A-Z]+\ /myadmin[/\s] [NC] RewriteRule ^myadmin - [NC,L,R=404] RewriteCond %{HTTP_HOST} =myadmin.movietunie.com [NC] RewriteRule !^myadmin/ /home/movietun/pub...

.htaccess rewrite regex: match anything but "index"

Hi guys and gals, I'm trying to create a rule used in a .htaccess file to match anything but a particular string, in this case: index. I thought that it should be possible to match this special string first and use [L] but that's not working, and it should be possible using the following regex, but it causes a 500 error. I want to mat...

Mod Rewrite Trouble

I want to have a main section which is found on services.php and then some sub-sections like services_logodesign.php. I want to make url's look like: When I click a button to open services_logodesign.php the browser should show "services/logo design" I have several other sub-sections, it will be nice to have one code for any other page...

Zend Framework in a subfolder

I have installed a Zend Framework application in a subfolder, something like this: www.mydomain.com/temp/zend-application/ Now the problem is all stylesheets, javascript files and also all links use relative paths, such as: /css/styles.css /js/jquery.js /controller/action And these go to the main domain like this: www.mydomain.com...

.htaccess in my project

Hai I want to know how to use .htaccess in my project. I know simply write the URL in to .htaccess file. After that what is the next step? what I will do to redirect the url ?? ...

Need help with .htaccess ReWrite rules

I'm using Wordpress and have the following pemalink /%category%/%postname%. This gives me user friendly URLs like http://www.example.com/something/. With this permalink, I will not be able to access php files directly, e.g. http://www.example.com/something/myfile.php. I need to write a ReWrite rule which allows me access to /include/my...

Problem with digest authentication using .htaccess file.

I'm trying to protect a folder with Digest Authentication through a .htaccess file: AuthType Digest AuthName "Restricted Area" AuthUserFile /web/htdocs/www.domain.com/.../.htdigest Require valid-user I've created the file of passwords with the comand "htdigest". All works fine on my local server ... but not on my remote server (hoste...

.htaccess problem: No input file specified.

Hello Everyone, Can someone help me with this. I'm feeling like I've been hitting my head against a wall for over 2 hrs now. I've got Apache 2.2.8 + PHP 5.2.6 installed on my machine and the .htacces with code below works fine, no errors. RewriteEngine on RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico) RewriteRul...

Allow a url to avoid a mod_rewrite rule in .htaccess

Hi, In addition to web access through my domain names, my ISP allows access to my website thruogh the following format: user.hostname.com, where user is my login name and hostname is my ISP. I have written rewrite rules to automatically remap user.hostname.com to www.mydomain.com, and this works well. It turns out however for me to vi...

htaccess rewrite

I am working on a project and it utilizes a shortened url for redirection, I've gotten the following code to work perfectly: XBitHack Off Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{REQUEST_URI} \/([0-9A-Za-z]{4})$ [NC] RewriteRule ^(.*) ./ge...

mod-rewrite problem in codeigniter

Hello, I'm developing a site on my localhost (Usbwebserver application). I'm using CodeIgniter framework: url is "http://localhost/daniel/index.php" with the following options: config/routs: $route['default_controller'] = "site"; config/config: $config['base_url'] = "http://localhost/daniel"; $config['index_page'] = ""; $config['...

Htaccess, mod_rewrite and regular expression for alphanumeric and dashes only

Hi, Just can't figure aout those regular expressions. I have an .htaccess file with some url rewrites. Look below what I have now: RewriteRule ^news news/ [R] RewriteRule ^news/([-A-z0-9]+)/$ news/$1 [R] RewriteRule ^news/([-A-z0-9]+)$ index.php?news=$1 [L] I don't think this is correct, I mean I think it could be better. This is w...

.htaccess Redirect to External Site and Forward POST data while Changing address bar?

Hey, I want to use .htaccess to redirect the requested page to the exact same page on a different domain, and I want it to forward all POST data while CHANGING the address bar to the new domain, like a normal redirect. Here's my code. Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.domain1.com/$1 [R=301,L] The pr...

How Do I make a simple .htaccess internal redirect Catch All script while forwarding POST data?

I just want to catch all requests and forward them internally to my catchall page with all POST data intact Catch all page: http://www.mydomain.com/addons/redirect/catch-all.php I've tried so many combinations, but my server doesn't want to redirect internally if I specify more than catch-all.php # Internally redirect all pages to "Ca...