Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

2
votes
3answers
2k views

.htaccess - if the file doesn't exist, rewrite to index.php but send 404 instead of 200

I have a catchall .htaccess directive like this: RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^(.*)$ index.php [L] Anything that doesn't exist and the URL is ...
2
votes
1answer
89 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 here. For example: RewriteRule ^(.*)$ $1.php [L,QSA] What does it signify?
2
votes
1answer
1k views

Multilingual and SEO URLs - best practice?

What would you recommend as a URL structure for setting up a multilingual site when optimizing for SEO? I'm thinking: www.yoursite.com/en/some-category/some-article/ ...
2
votes
3answers
2k views

mod_rewrite works within directory not on root

I am having a problem with my RewriteRule for the querystring portion. What I am able to debug is that the rule is being triggered at least because the page "tags.php" is being rendered but without ...
2
votes
3answers
475 views

Displaying a “coming soon” image to users whilst I work on website redevelopment [duplicate]

Possible Duplicate: 301 redirects for all except me I've been developing a new version of my website for a while now, on a different directory to my currently-live website. Shortly I'll be ...
2
votes
2answers
302 views

Can you rewrite the root?

Not sure how to word this one but will explain most I can. I am trying to make the following happen. Re-write this http://domain.name To this http://domain.name/home/ Is it possible ? update ...
2
votes
2answers
3k views

Mod Rewrite - directing HTTP/HTTPS traffic to the appropriate virtual hosts

I have an Apache2 web server (v. 2.2.16) running on Debian hosting three virtual hosts. The first two hosts are HTTP only (server1 and server2). The last host is HTTPS only (server3). My virtual host ...
2
votes
2answers
106 views

Unwanted redirect from a domain to my site

An external person from my client company registered a domain and redirected to my client URL. For instance, if you type unwanteddomain.com it redirects to myclientdomain.com. Is there any way to ...
2
votes
2answers
178 views

How to set restrictions on my website?

Currently my website is under maintenance. I want to be the only person who's able to access/view the website online until I finish maintenance. How to set restrictions to others ? I hate stalkers.
2
votes
1answer
1k views

What is redirecting mobile visitors to our website?

Our site may have been hacked. It loads okay on desktop browsers, but on mobile devices it redirects to a porn site. I can't see anything in the source code or .htaccess which would be causing this. ...
2
votes
2answers
4k views

How can I fix the #c3284d# malvertising hack on my website?

For the past couple of weeks at semi regular intervals, this website has had the #c3284d# malware code inserted into some of its .php files. Also the .htaccess file had its equivelant code inserted. I ...
2
votes
1answer
355 views

zlib compression issues

I'm having some issues running zlib compression on my site .. Firstly if I enable zlib compression in .htaccess using: php_value output_handler ob_gzhandler then I receive thousands of lines of the ...
2
votes
1answer
227 views

How to make password protection with .htaccess file more user-friendly?

I have this in my .htaccess file: <FilesMatch "(contracts|concepts)$"> AuthName "Contracts" AuthType Basic AuthUserFile /is/htdocs/wp54963193_ZBG2Q9J2R8/www/.htpasswd ...
2
votes
1answer
16k views

Apache: Virtual Host and .htacess for URL Rewriting not working

I have configured a virtual host in my local machine and every thing is working fine. Now I want to use SEO friendly urls. To achieve this I have used the .htaccess file. My virtual host ...
2
votes
4answers
5k 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, ...
2
votes
1answer
1k views

=~ (equal-sign tilde) and m“ … ” in .htaccess directive

I saw this bit of code on an old forum post: SSLRequire %{HTTP_HOST} =~ m"\.secure\.powweb\.com" And I was just wondering what the =~ and m" ... " meant. I've been searching online and in the ...
2
votes
2answers
424 views

Restrict access to web directory with .htaccess

Let me just say that doing this sort of thing with .htaccess files has never been a strong point for me. Let's say that I have a directory in my web root: /dir/data Within that directory let's say ...
2
votes
1answer
861 views

How to stop access of a PHP file from other sites

I read somewhere about hot linking of images. Preventing image hot linking helps to stop bandwidth theft from your site. Would it work for a PHP file? In my case, I am using a PHP file to generate ...
2
votes
1answer
48 views

Cache control header specified in .htaccess is not working for static files

I'm trying to use Google PageSpeed Insights to speed up my website - www.edmhunters.com. First off, here is what my .htaccess file looks like # ...
2
votes
2answers
47 views

HTTP code 403, access denied & Options -Indexes

at "webmasters.stackexchange.com" I already found a similar topic: Stop directory listing using .htaccess and redirect to good error page Options -Indexes ErrorDocument 403 /path/to/403.html ...
2
votes
1answer
78 views

Rebranding: how do I redirect my website to a new domain, and blog to a subdomain?

I have a website that I am rebranding and using a new domain name for. Right now it is primarily a blog hosted at the root. I am going to be redirecting from www.old.com to www.new.com, and I also ...
2
votes
2answers
148 views

How to prevent JavaScript directory access with htaccess

I have a website like http://example.com but the problem with it is that people are able to get access to my JavaScript by pointing a browser to http://example.com/js/. I have little knowledge of ...
2
votes
1answer
264 views

Problem with my subdomain with .htaccess root as subdir

I am working on a site making my subdir to appear as root just like //domain.com/ is //domain.com/subdir and also access/load files hiding the subdir. My site have this .htaccess(below) and its ...
2
votes
3answers
112 views

We changed our domain a year ago to .com but old site is still number one when searching

I changed our companies domain name a year ago from radfan.co.uk to radfan.com. When typing radfan into Google the number one result is still radfan.co.uk rather than the .com. This is not the case ...
2
votes
1answer
103 views

Which way to forward alternate domains?

I have a few alternate domains that I want to point to my main domain: Main: awesomewebsite.com Alternates: awesomewebsite.net, awesomewebsite.co, awesomewebsite.me Which is the best way to forward ...
2
votes
3answers
317 views

Clean URLs issue using .htaccess in PHP project

I am working on a PHP laravel project. I am currently facing issues with .htaccess file. I have following .htaccess: <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / ...
2
votes
2answers
401 views

HTACCESS Wildcard Subdomain forward to Domain

I know this may seem like a duplicate, but I am unable to find a solution. Is it possible to setup wildcard subdomains with htaccess? I have an example of http://test.domain.ca I need to forward ...
2
votes
1answer
251 views

How to hide download file from bots? [duplicate]

Possible Duplicate: How to restrict the download of all files in a folder? I want to make a private file available for download but not use username/password protection. I want to put the ...
2
votes
1answer
431 views

Tell apache to point to a subfolder as default starting point for public

What would be the different methods of telling Apache to serve up httpdocs/public instead of httpdocs as the default starting point? I want to be able to have my includes and logs directories behind ...
2
votes
1answer
485 views

Htaccess - Rewrite png to php file

I currently use trans.png.php?id=1&campaign=test to track my newsletter campaigns. I want to use trans.png instead as it's the src of an img tag. How can i do this in htaccess? Also is there any ...
2
votes
1answer
2k views

.htaccess - lose the file .html extension

I'm having a bad .htaccess day! I want a user to be able to type the URL mysite.com/about instead of mysite.com/about.html On .htaccess file I have: RewriteEngine On RewriteCond ...
2
votes
2answers
2k views

How to manage multiple domains on same server

I have more than one (4 to be exact) domains and only one server host with same ip. How I can run all my domains from same server. All websites are wordpress sites.
2
votes
2answers
394 views

Image Hot-links & Google's Instant Previews

I'm trying to adjust my site: 1. stop Image Hot-links 2. block Googlebot-Image (because I do not want my images to be searchable) 3. allow Google's Instant Previews I've tried this but the Instant ...
2
votes
1answer
357 views

Configuring directory access on a server. .htaccess and alternatives?

I have written a small PHP package/site-template (should I say). It contains a directory data/ that contains some important files that the users should not be able to see. These file should however ...
2
votes
2answers
64 views

SEO: Is forcing a request to WWW.domain.com from domain.com a bad idea?

I have an htaccess file that is forcing the URL request to www. instead of a bare hostname (this is to resolve SSL issues I'm facing that are fixed when you visit the site via www.) Is this a bad ...
2
votes
2answers
935 views

Redirect all traffic to construction page except my IP in .htaccess

The title pretty much says it all. I want to direct all traffic to an under construction page except for traffic originating from my IP address so I can move a large development site into production ...
2
votes
3answers
759 views

Subdomains vs folders, for multi account/users application

So, for a multi user web app, what is better: http://username.domain.com Or http://domain.com/username I would like to get feedback about security, scalability and maintenance specifically, app ...
2
votes
2answers
8k views

Redirect/Rewrite Subdomain to Subfolder

I'm trying to redirect a subdomain to a subfolder e.g. forums.domain.com to www.domain.com/forums Note that I started the forums in the subfolder format but worried that members might mistakenly try ...
2
votes
1answer
147 views

Apache mod_rewrite problem

I try to use Apache mod_rewrite to redirect some pages on my customer's website to the homepage. The .htaccess file is the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ...
2
votes
2answers
1k views

How can I redirect everything but the index as 410?

Our site shut down and we need to give a 410 redirect to the users. We have a small one-page replacement site set up in the same domain and a custom 410 error page. We'd like to have it so that all ...
2
votes
1answer
48 views

Rewrite up to three folders into three query string parameters to a PHP script

I'd like to use mod_rewrite within the .htaccess file to rewrite folders to a var string. Below is examples of current and what I would prefer. Current URL: example.com/main/folder1/folder2/folder3 ...
2
votes
1answer
102 views

How do I do a catch-all .htaccess redirect?

A site has moved from example.net to example.com/ie/en/. (In other words, it’s moved from being its own domain to being a subfolder in a larger site.) However, the page structure has also changed. I ...
2
votes
2answers
185 views

Why does .htaccess not prevent a php script from accessing a file

I ran into the following issue: On a website I want to prevent "unauthorized" access to a set of .xml files - the user has to authenticate first. Now it would be possible for an authenticated user to ...
2
votes
1answer
88 views

.htaccess port 80 to another port SEO impact?

I am using the Ghost blogging platform. By default to access the blog you go to blog.my-site.com:2368 of course this makes for a ugly, unfriendly URL. I am using .htaccess to change the behavior so ...
2
votes
2answers
268 views

How to block user agent from accessing my WordPress site with htaccess?

I have noticed large amount of traffic coming to my site from different IP's with user agent. Mozilla/5.0 (compatible; SiteExplorer/1.0b; +http://siteexplorer.info/) I don't have much experience ...
2
votes
1answer
197 views

Changing file extensions in URIs - Server Error after Apache upgrade

Please can anyone help to identify flaw or incompatibility in .htaccess code causing server error? In the process of changing over from static to dynamic website, I had to maintain some static files ...
2
votes
1answer
252 views

Can I set Cache-Control in the .htaccess file for a specific part of a document (just a section of the <body>)

I noticed, by using Google Page Speed Insights, that if I structure my HTML to load the critical, above-the-fold content first, my page will improve performance - and it woks (with now current perf. ...
2
votes
1answer
368 views

Rewrite rule not working for redirect in subdomain hosted in a subdirectory of the main site [closed]

I am running a WordPress network. This means there are multiple websites produced by one installation of WordPress. Each website is a subdomain of the parent website. WordPress handles the creation ...
2
votes
1answer
95 views

Website won't work without www on mobile phone

I have updated the .htaccess file so that when someone types in example.com, they are redirected to www.example.com. This works great on my computer, but when I try it on my cell phone is does not ...
2
votes
1answer
28 views

Ideal cache times for browser caching times for different file types?

I am trying to improve my site's performance - and that includes caching. I found some great caching via .htaccess from the boilerplate html5 template - but the cache times seem odd. Does anyone ...