.htaccess

Redirect website root to subdirectory

How can I redirect all requests going to web root to another folder (e.g. public/)? I've already tried this (contents of .htaccess in web root): RewriteEngine on RewriteRule ^(.*)$ public/$1 But now I have duplicate content for addresses: address.tld/ and address.tld/public/ I would like to redirect address.tld/public/ to address.tl...

mod_rewrite new URL for pages plus wordpress?

I need to change the domain for both a wordpress and a number of hand-coded pages. Is there a way to write something in .htaccess so that www.olddomain.com/* goes to the corresponding www.newdomain.com/* for everything? ...

How to pass http://www.domainname.com as variable in htaccess?

Hi, In my htaccess I have line RewriteRule ^link-([0-9]+)-(.*).htm$ link.php?id=$1&link=$2 [L,NC] For variable 2 there may be link as well. For example: http://wwww.mysite.com/link-10-www.domain.com/click.htm?id=497&mid=13&prod=1&productname=name&target=http://www.domainname.com/name2.htm. When i click on this link,...

How can I rewrite a specific URL?

I want to rewrite the following urls: node/add node/edit etc To be something like - content/add - content/edit I also use the prepopulation model, and would love to able to rewrite this URL: node/add/single-gallery-image?edit[field_gallery_node_reference][0][nid]=48 To something like this: content/add/image?n=48 Is this po...

how to control request with htaccess

# BEGIN <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END I am a beginner in htaccess , so does any one help me to describe what is that lines means? ...

How to allow access only within country

I found this web site to generate a .htaccess to block an access from certain country. The problem with this is that I want to allow access only within Norway. If I use this service, the list will be very long since I have to list all the country IP addresses. Is there any way to allow access within country, my case is Norway? ...

.htaccess redirect without changing address bar

I'm trying to write an .htaccess rule to redirect to a script, which further redirects somewhere else. Kind of like how URL shorteners work. However, I don't want the address bar to change during the .htaccess part of the redirect. (It's okay for the script redirect to change the location.) I'm using mod_rewrite, currently doing this: ...

mod_rewrite ecommerce URL design

I have problems with how I should structure my product listing pages, products pages, webpages. It roughly translate into this: /bags/nicebag.html = /product.php?product=nicebag&category=bags /nicebag.html = /product.php?product=nice_bag /bags = productlisting.php?&category=bags Problem is that webpages will share same URL structure...

Rewrite subdomain to subdomain/folder in vhost situation

I'm trying to rewrite abc.example.com/path to abc.example.com/index.php/abc/path using the following .htaccess: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(abc)\.example\.com RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/abc/$1 [L] The situation is: domain www.e...

How Do I Serve a File Through JSMin PHP Script With Correct HTTP Caching (using .htaccess?)

I'm using the PHP script for JSMin to remove comments and whitespace from my javascript and css files before serving. If I set <script src="jsmin.php?file=myfile.js"> the file is not ever cached, since the Last-Modified HTTP header is never checked for a script. So in order to run the files through JSMin and (hopefully) enable cach...

.htaccess Apache on cPanel only working in some cases

Hey there SO, I'm using the Zend Framework, so I'm bootstrapping into a file called index.php. Naturally, I don't want images to be bootstrapped, so I've added a .htaccess file. Here's what it looks like /application /library /public (this is the root of the site) /images /js .htaccess index.php This is what's w...

Getting "mywebsite.org/" to resolve to "mywebsite.org/index.php"

At my work we have various web pages that, my boss feels, are being ranked lower than they should be because "mywebsite.org/category/" looks like a different URL to search engines than "mywebsite.org/category/index.php" does, even though they show the same file. I don't think it works this way but he's convinced. Maybe I'm wrong though...

Redirect dynamic subdomain to same subdomain with subpage. How?

Hello, I'm a little stuck in here. I need to get some help with this subdomain-situation. I need to redirect http://dynamicsubdomain.example.com/ to http://dynamicsubdomain.example.com/account/welcome.html. How do I do this? I tried several things but all without result. The main problem is that I can't fetch the entered dynamic subdom...

What's wrong with this mod_rewrite rule?

Can anyone spot what is wrong with this URL rewrite? I can't get it to pass anything to GET (the script loads, but no parameters are passed): RewriteRule ^archive(/(.*))?$ archive.php?action=$1 [QSA,L] I want to map "archive/browse/" to "archive.php?action=browse". ...

Redirect ALL requests under a domain to static page - .htaccess or 301 or RedirectMatch?

Hey everyone, I am trying to redirect ALL requests for mydomain.com whether they are something like: http://www.mydomain.com http://mydomain.com http://mydomain.com/photos http://mydomain.com/index.php?id=672 to be redirected to http://mydomain.com/index.html As long as it has mydomain.com in it, they should see this page - its...

htaccess character encoding issue

I have page which is redirected from htaccess. now I can pass the German characters as params like site.com/maörx/idasd Options +FollowSymLinks RewriteEngine on RewriteRule ^([a-zA-Z0-9äÄöÖüÜéß\-]*)/?$ page.php?var=$1 [L] it is working in the localhost . but not on the server.... server i am getting the same old issue(Error 404:Obj...

Apache modrewrite htaccess problem

Hi, I have a rule, that gets up to three parts, separated by a / (slash). They represent /app/controller/action, but they are optional, which means /, /app, /app/controller work as well. The thing is, I want another rule, before this one, which would set the default app to "frontend", and I think it should look like this: RewriteRule ...

Google juice with subdomains and porting an application using rewrite rules

Background: I've got a web app on sub.domain.com. My primary website is on domain.com. My sub.domain.com pages are stuffed with keywords that I would like to use to get upped in pagerank on domain.com. however, the whole app has been written on sub.domain.com, and it'll be some effort to host it at domain.com/subdirectory, due to how ...

Rewrite URLs for a website in a subdirectory

Hello guys! I'm developing a website on localhost using XAMPP under Windows 7. The website URL is http://localhost/lyrics. How can I enable url rewriting for that subdirectory? I tried with the code below but it didn't work. RewriteEngine On RewriteBase /lyrics Thanks in advance. ...

Help .htaccess Server error

Hello, i added this code to .htaccess and place it the root of my website: $allowed[0]="xxx.xxx.xxx.xxx"; $allowed[1]="yyy.yyy.yyy.yyy"; // add as many as you need if (!in_array($_SERVER['REMOTE_ADDR'],$allowed)) header("HTTP/1.1 403 Forbidden"); ?> but it's seems it doesn't work, I'm getting server error page can you plea...