Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

5
votes
2answers
77 views

Is a masked 307 redirect for a domain possible?

I've been asked to create a 307 redirect for a domain, ensuring it is "masked". i.e. keep the original URL in the address bar. There isn't a lot of info available about 307 (as opposed to 301/302) ...
5
votes
1answer
11k views

How can I use .htaccess to rewrite different domains to different sub-directories, masking the sub-directory?

I have a shared hosting plan that allows unlimited addon domains, but they can only point to the public root (/). I use .htaccess to point different domains to their corresponding sub-directories. For ...
5
votes
2answers
2k views

Rewrite rule to show as directory using .htaccess

I want to implement a rewrite rule in my .htaccess file to show a specific url as a directory of my server. See the code below I written, RewriteRule ^(.*)/$ ?page=$1 [NC] This will rewrites urls ...
5
votes
1answer
683 views

Redirect URLs with a # in .htaccess

On one of my sites I get 404s because some scripts are fetching all URLs from the start page as raw URLs, so they include the # in the URL. Normal browsers don’t ever send that part to the server, but ...
5
votes
1answer
2k views

Redirect from SSL HTTPS to HTTP (NO SSL)

Many of my visitors have bookmarked my site already with https://mydomain.com. Under the bad advice of a programmer I have put my whole site (Joomla) using SSL. I do not sell anything or provide any ...
5
votes
2answers
1k views

URL rewritten pages take much longer to load

(Same issue as http://stackoverflow.com/questions/3987754/how-to-diagnose-htaccess-speed-issues-via-rewritelog but more clearly explained below) We have a site which has scripts like this: http://...
5
votes
2answers
2k views

How to 301 redirect from old query string URLs to CakePHP Canonical URLs?

I currently have a .htaccess file that looks like this: RewriteCond %{QUERY_STRING} ^action=view&item=([0-9]+)$ RewriteRule ^index\.php$ /index.php?url=item/%1 [R=301] RewriteCond %{...
5
votes
1answer
970 views

How do I setup authentication on a specific folder using .htaccess?

I have a folder that I want to host files privately on my webserver. How do I go about making it password protected using .htaccess? Note: Nothing monolithic, I want something that is simple/easy so ...
5
votes
1answer
988 views

How can redirect pages from old core PHP site to new Joomla site?

We have our old site into core PHP and we have developed it again into Joomla 1.5 last year (because of some limitations we have to build it into 1.5). Now the problem is the URL of sites changed as ...
5
votes
1answer
937 views

URL masking with .htaccess

I need a hardcore programmer to help me with URL masking. So this is my situation. My website www.michaelfotograf.dk/blog/ is the main site that needs to be configured. I have another website/...
5
votes
2answers
1k views

302 Redirect causes garbage at end of Wordpress link in Facebook

When I try to link my Wordpress blog to Facebook, the url doesn't resolve properly. There's garbage appended at the end and Facebook is not able to retrieve information from the site. Happens in ...
4
votes
3answers
1k views

How do I block US users from my website without interfering with SEO?

My website uses Apache 2.2.14 (which forwards all requests to Tomcat underneath). I need to block all US users from accessing the website (and potentially users from other countries). But importantly ...
4
votes
6answers
674 views

SEO - which URL's are the best?

I'm using .htaccess with RewriteRule to create SEO-friendly URL's. However, I have a few questions about this: First of all, I noticed many websites end their URL's with .html (or another ...
4
votes
2answers
4k views

URL rewriting removing question mark and replace it with slash

How can I rewrite my URL from edit.php?id=2 to edit/id/2?
4
votes
3answers
629 views

Check for URLs that return my 404 error page

I have made a custom 404 error page called error_404.html In my .htaccess I inserted: ErrorDocument 404 /error_404.html In order to control/correct 404 errors in my website, I would like to know ...
4
votes
3answers
780 views

SEO Joomla URL to WordPress URL's

I am trying to migrate from Joomla 1.5 SEF URL's to WordPress SEF URL's. The old links use this formatting: /site/sectionname/categoryname/id-titlename.html I want to migrate it to /wp/index.php?p=...
4
votes
2answers
1k views

Difference between “/” at end of URL and without “/” [duplicate]

Possible Duplicate: Does it make a difference if your url ends in a trailing slash or not? Why treat these as different URLs? I am doing a 301 redirect in my WP application using .htaccess ...
4
votes
1answer
102 views

What's the “^” in RewriteRule Statements?

I keep seeing the ^ character in RewriteRule statements in a context that doesn't fit with the usage specified in this document about regular expressions. For example: RewriteRule ^(.*)$ $1.php [L,...
4
votes
1answer
17k views

How to redirect any URL to lowercase URL?

I have this .htaccess files: ErrorDocument 404 /index.html <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule (.*) http://...
4
votes
3answers
3k views

Subfolder won't permenantly redirect to subdomain

Right now I have the following code to redirect all non-www URLs to www URLs: RewriteCond %{HTTP_HOST} ^example.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Besides that redirection, ...
4
votes
2answers
96 views

ErrorDocument in dynamic SubFolder

I host different Websites in 1 web space. But I don't want to give the ErrorDocument an absolute SubFolder name. Is it possible to make website a variable? ErrorDocument 404 /website/error?error=404 ...
4
votes
2answers
364 views

redirecting https to http

RewriteEngine on RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301] # WordPress Defaults RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} ...
4
votes
3answers
447 views

Googlebot robots.txt access error on HTTPS when redirected from HTTP

This might be a stupid question, but I never came across this issue before and were not able to find any definite answers to this on the web: Our client migrated to HTTPS a few months ago, using ...
4
votes
2answers
1k views

GoDaddy: RewriteCond in .htaccess not working with “beginning of the line” (^)

I have .htaccess containing RewriteCond and RewriteRule. It used to work just fine (it's been a long time since I last checked), but now it has stopped working. I have narrowed it down to the ...
4
votes
1answer
474 views

How can I serve all resources under HTTPS instead of HTTP without changing their URLs in the HTML code

I know that by using an .htaccess file I can redirect everyone to https://. However, my SSL certificate complains if all the content isn't served under HTTPS. Is there a way to convert all the ...
4
votes
2answers
239 views

One million redirects

What's the best way to redirect 1,000,000 unique URLs to another 1,000,000 unique URLs? These pages are all combinations of multiple search filters and queries. We're migrating the site to cleaner ...
4
votes
2answers
585 views

Redirecting URLs when launching a new website - how to avoid dropping page rank

i have over 100 urls in my website which i need to redirect: E.g. /page/how-to-bake-chocolate-cookies/ will redirect to /cookies/how-to-bake-chocolate-cookies/ /page/contact/ will redirect to /...
4
votes
2answers
208 views

Any chance to redirect homepage to a changing permalink without irritating search engines?

We have a php 5.3/Apache 2.2 based cartoon website that always shows the most current cartoon on the homepage (index.php). Now, a lot of people want to link directly to that cartoon (by copying the ...
4
votes
1answer
3k views

What do I put in htaccess to create a 410 error page when a URL parameter is present?

I tried to create a 410 error page but realized that I actually created a 302 redirect to a 410.php page. Instead I want to use a 410 error to block out an infinite number of dynamically created pages ...
4
votes
1answer
90 views

Is there any difference, from Google's point of view, on the method used for a 301 redirect?

I have a website with an extremely good Google rank for it's particular niche. I've rebranded and need to redirect to a new URL. In the eyes of Google, what's the difference, if any, between the ...
4
votes
4answers
16k views

How to verify what modules are active on my server?

While trying to solve a problem on my website, a recommendation about my .htaccess file I got was First of all, please check on the server for all the different modules if they are enabled, ...
4
votes
1answer
118 views

How to redirect URLs with a specific IDs to new URLs on a new domain name?

I want to redirect all pages where there is a specific word inside in the URL. Both websites have the same articles. For example: videos.example.com.ph/its-showtime-hashtags-hashtags-and-dawns-...
4
votes
1answer
2k views

What are the most commonly used and basic Apache htaccess redirects?

This question is here so we can offer users who are looking for information on how to make one or more common or basic redirects in Apache using the htaccess file. All future questions pertaining to ...
4
votes
3answers
4k views

using .htaccess to redirect .asp to .php?

Ahoy all! I've been racking my brain with this one. I basically just converted all of my pages from ASP code to PHP code. Kept the same filenames. So, here is the htaccess code I have so far, but ...
4
votes
4answers
3k views

How to create .htaccess to block access to a subdirectory that hosts a separate domain

I have a main domain (me.com) and I am hosting files for my mom's website (mom.com) in a subdirectory in my public_html folder so that mom.com uses files from me.com/mom. All I want to do is make it ...
4
votes
4answers
272 views

How to restrict access to my site using htaccess

How to disallow access to site except me?
4
votes
2answers
656 views

htaccess ErrorDocument 500 not working

I have a site whose .htaccess file contains: ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html The 404 redirect works just fine, but when I encounter a 500 Internal Server Error,...
4
votes
3answers
2k views

htaccess redirect non-www to www with SSL/HTTPS

I want a rewrite rule that redirects everything to https:// AND www. For example https://example.com should be going to https://www.example.com This is what I have: RewriteEngine On RewriteCond %{...
4
votes
2answers
124 views

Create redirect from url like www.example.us/?p=100&option=

I am switching CMS and have about 600 URLs that need to get redirected to the new scheme. The URL on the old site looks like the following on my test server: www.example.us/?p=100&option=...
4
votes
2answers
262 views

non-cachable Canonical redirect of www to non-www

I know this question is debatable for the whole eternity, and most likely nobody knows the real philosophy of this problem. But I'm trying to solve the problem about 301 and 302 response headers in ...
4
votes
1answer
344 views

.htaccess and gzip compression

i have question about GZIP compression, actualy my wordpress website doesn't have .htaccess to be able to use that feature, so can i create .htaccess file only for gzip, it won't change anything on ...
4
votes
1answer
40 views

.htaccess rule fails when including $ at end

The Basic Situation We have a server. It has some static files, some simple, "flat" .php and .html pages, but it also has a WordPress install at the document root, meaning that visiting / takes the ...
4
votes
1answer
262 views

Too many redirects due to htaccess code

TL;DR: What does the following line of code do? Does it remove trailing slashes from a URL? RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L] I inherited a Drupal site with little knowledge ...
4
votes
1answer
179 views

How do I tell a directory that all files inside should be treated as a PNG?

I have PNGs in which for instance they are named "5021" rather than "5021.png" and for some images it is fine and displays like a normal image but others download automatically; I was told by someone ...
4
votes
2answers
3k views

How to write a generic .htaccess file rule, regarding RewriteBase

The following rule in my .htaccess works just fine for routing calls to index.php: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] However, this does not ...
4
votes
1answer
5k views

Extend depth of .htaccess to all subfolders and their children

I need to be able to use .htaccess in all subfolders for full depth. E.g. I have .htaccess in public_html folder: \public_html\.htaccess How I make it to work for the folder small as well? \...
4
votes
1answer
285 views

Hosting multiple sites - Mask URL?

I have a hosting account where I have my main site (www.mainsite.com points to root folder), and a subfolder xpto.com, where I want to have another site (www.xpto.com). I can access www.anothersite....
4
votes
2answers
871 views

How do I redirect an English language URL to an Arabic language URL?

I have a link that's currently formatted like this: http://example.com/news/view/1.html I want to it redirect it to: http://example.com/خبر/عنوان-الخبر where خبر is equal to news and عنوان-...
4
votes
1answer
516 views

Multiple 301 redirects, do search engines / user-agents see them all?

I've put in place a lot of different 301 redirects to deal with numerous URL changes. And for certain URLs there are 3-4 different 301 redirects landing the visitors to the new URL. I heard that 301 ...
4
votes
1answer
32 views

.htaccess redirect url to a subfolder on a subdomain with exceptions

I have a CMS installed on a subdomain (say blog.domain.com). I created a site on it but the site can be accessed at (blog.domain.com/sites/mysite). I also have to use other links like blog.domain.com/#...