.htaccess

Using .htaccess to rewrite the url in a sub directory.

I want to redirect a url pattern like http://abcd.com/some/sub/directory/var1 to http://abcd.com/some/sub/directory/?search=var1 I've read other posts like this. But none of them solved my problem. I don't have write access to root directory. So I've placed this .htaccess file in "/some/sub/directory/" Edit : Here is my current ...

.htaccess headache with perl script?

Trying to get a simple test perl script working. Have the following files/folder structure on a shared hosting service: ~/public_html/ .htaccess ~/public_html/lookup Permissions: "drwxrwxrwx 2 myusername myusername" .htaccess lookup.pl* Permissions: "-rwxr-xr-x myusername myusername" The first .h...

Detect iPhone browser in .htaccess/apache and redirect to iPhone site

Is it possible to detect iPhone browser agent in .htaccess and redirect the user to the correct iPhone page? ...

Using .htaccess to rewrite clean & custom URL structure

How do i redirect website.com/about.php to website.com/about Also, is it possible to manually create the appearance of subdirectories using .htaccess? i.e. website.com/project1.php to website.com/projects/project1 Much appreciated! ...

How use htaccess for seo friendly url with subdomains?

This is my htacess file: RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com(.*) RewriteRule .* inside.php?tx=%1&filter=%2 This url: hello.mydomain.com goes to www.mydomain.com/inside.php?tx=hello Thats correct. Now i need this url hello.mydomain.com/bye/ goes to www.mydomain.com/in...

htaccess problems with redirect for no www

I've been trying everything to manage a redirect from www.domain.com to domain.com, but nothing seems to work for me. I always get a redirect loop - and I've tried various things I found here or on Google. So here is my .htaccess, maybe someone could help me figure out what I can do to redirect correctly or if there is something wrong i...

RewriteRule question

RewriteRule ^foo-bar-([0-9]+)-([a-z]+)-([a-z-+]+)/$ index.php?a[]=&b=$1&c=$2&d=$3&e=$4&f=$5 [L,NC] how could i put the last parameter from rule to not be required without to add two lines and in first one to remove it, then in second to remain..? so, rule to be in one line but to have two option to acees url like: /foo-bar-2-steps/ ...

Variable in htaccess, RewriteRule question

How could i use a RewriteRule accesing a variable? If i have: SetEnv MY_VAR (a|b|c) RewriteRule ^%{ENV:MY_VAR}$ index.php?s=$1 [L,QSA] RewriteRule ^%{ENV:MY_VAR}-some-one$ index.php?s=$1 [L,QSA] I have these examples but doesn`t work. Later edit Ok Tim, thank you for the answer. Let say that i have: RewriteRule ^(skoda|bmw|merce...

404 Redirect is not working

In my htaccess file my ErrorDocument 404 statement is not redirecting to index.php. Instead, i'm getting a regular 404 error. This is a regular apache installation. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System....

.htaccess redirect "domain.tld/" to "domain.tld/home.html"

Hello everybody. I have a website here on my localhost : http://localhost/mysite/www/index.php I have some RewriteRules to redirect like this : http://localhost/mysite/www/index.php?page=home -> http://localhost/mysite/www/home.html And now, I want to do a redirection like this : http://localhost/mysite/www/ -> http://localhost...

complex mod_rewrite. Any idea ?

Hello everyone, I want to : - switch from http to https if http is used - redirect the subdomain to index?o=subdomain except www - redirection the subdirectory to index?u=user Example : http://www.mydomain.com will be redirected to https://www.mydomain.com http://subdomain.mydomain.com will be redirected to https://www.mydomain.com/in...

.htaccess Maintenance Multiple IP's

Hello - I am using the code below within my .htaccess file to place my site into maintenance. Essentially what it does is to redirect anyone who is NOT from a specific IP address to a .maintenance. subdomain where I have a maintenance page up (thus allowing me to perform testing on the real site). My question is, how would I add a sec...

Help with .htaccess

Hello I need help with .htaccess I was using RewriteCond %{REQUEST_URI} !^/unsubscribe(/.*)?$ [NC] that to make a folder load without affecting of RewriteRule ^([0-9]+) view.php?id=$1 [NC] I want rewrite the rule to make a folder independent without doing of other rules into that folder Current code to do so is : RewriteCond %{REQUE...

Redirect parked domain (htaccess)

I have two domains in the format of foo.com and foo.net. I currently have the following in my .htaccess to redirect non-www to www: # Rewrite URL to force WWW RewriteCond %{HTTP_HOST} ^[^.]*\.[^.]*$ RewriteCond %{SERVER_PORT} !=443 RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_HOST} ^[^.]*\.[^...

How to redirect permanently (301) via .htaccess?

Hey guys! Can you please advise me how to modify my .htaccess so that http://example.com (non-www without trailing slash) http://example.com/ (non-www with trailing slash) http://www.example.com (www without trailing slash) will be permanently redirected (301) to http://www.example.com/ (www with trailing slash)? Additionally, are t...

I need help breaking an Apache .htaccess 301 303 Redirect Loop!

Here is my .htaccess: Options +FollowSymLinks +SymLinksIfOwnerMatch #non .PHP files <Files manage> ForceType application/x-httpd-php5 SetHandler application/x-httpd-php5 </Files> <Files profile> ForceType application/x-httpd-php5 SetHandler application/x-httpd-php5 </Files> <Files process> ForceType application/x-httpd-php5 SetHandle...

.htaccess redirect from directory it's in to specific subdirectory without filename

Hello, I have a server. (Apache). On this server there is a subdirectory (subdir1). In this subdirectory, I have an .htaccess file. How can I set up this .htaccess file to redirect me from the directory it is in (regardless of what the directory is called) to a specific subdirectory? Redirect {current .htaccess directory} {current .hta...

.htaccess rewrite subdirectories to null

Hello, I want the browser location bar to show http://dir/ when I really am in http://dir/subdir/subdir. How do I do that? Thanks in advance! ...

PHP / Apache, very weird redirect issue...

with NO .htaccess in place, all requests to /login go straight to /cart/register which then goes to /cart no code in any of those files gets executed (PHP files) there is nothing in the httpd.conf referencing "login" or "cart" Any help would be MUCH appreciated! ...

htaccess redirect if URL contains a certain string

How would I write a htaccess redirect rule if the URL contains a certain word e.g. If contains "foobar" then redirect to index.php Any help greatly appreciated ...