tags:

views:

408

answers:

9

Is anyway to run .htaccess file in local server without using online?

+4  A: 

I'm not sure whether I understand your question, but yes, you can use .htaccess files in any Apache installation, whether that Apache runs on the internet or locally.

Pekka
Yes apache only, run on locally not in internet. Is it possible?
Karthik
@karthikeyan yes. See www.xampp.org for easy installation packages.
Pekka
@karth there is no difference between "internet" and "local" calls
Col. Shrapnel
If i using the .htaccess files in internet and local, in internet it working fine but in local i cannot get display the page. Why it is ? anything i have to do with internal local server or any configuration is there ?
Karthik
@karthi please update your question with the source code of the .htaccess and what you just said.
Pekka
If by 'local' you mean you're using file:/// URLs, then no, .htaccess will be useless to you, as you're not actually using Apache.
Marc B
A: 

A .htaccess file is a means to configure a webserver on the fly, and without needing access to the global configuration files.

Since all it does is configure a server, it doesn't make sense for it to be involved without there being networking (even if only localhost to localhost networking) involved.

David Dorward
+9  A: 

.htaccess file is never being "run". It is merely a config file. Unnecessary one, as every it's command can be used in the main httpd.conf config file.

what is the background led you to this question?

to make this file enabled, AllowOverride All setting in the httpd.conf file must be set

Col. Shrapnel
to add to this. If you access to your server's httpd.conf, you can simply put the contents of your .htacces into your <Directory> tag and set AllowOverride None for a slight performance boost.
JoeyP
It depends on the kind of stuff one would allow external .htaccess files to do. It could be something different from AllowOverride All, setting options as the httpd.conf (or apache2.conf) says in the comments...
Alfabravo
A: 

Yes, you can use any .htaccess file in any Apache instance regardless of platform. A service on a server is still a service on a server irrespective whether it is accessed on a local network (or even the same machine) or via a wider network (i.e. the Internet).

Konrad
A: 

Set AllowOverride All in configration file your Problem will b resolved.

OM The Eternity
+1  A: 

.htaccess files are not considered when running php from the command line because Apache isn't called. But, as long as you are making a web request through Apache, and you have AllowOverrides configured properly for that directory, the .htaccess should be read and used by Apache.

borodimer
A: 

Regardless of the setting in your config file, if you do not want online access do not forward port 80 to your server, if you do want online access then do forward port 80.

typoknig
+3  A: 

Not much detail in your question, but let me try an angle that hasn't been taken yet (as far as I noticed).

If you're asking why the .htaccess file works for this request:

http://myserver.com/mypage

Or even this request:

http://localhost/mypage

But not this request:

file://www/mypage

It's because the first two are actual HTTP requests, requiring the page to be 'served' by Apache. Apache (assuming a correct configuration for your situation) processes the .htaccess file while serving the request.

That whole process is bypassed for the third 'request', because that's not a HTTP request, that's a local filesystem request. In that case the web browser is loading a file much like a word processor. No web server is ever contacted, so the .htaccess file is meaningless.

If that's what you mean by local, then to my knowledge there's no way to get a browser to process the .htaccess file for a local request.

But in the future, there's a world of difference between requesting a flie for a local server, and loading a file from a local system.

Again, this is only my take on one way your question could be interpreted, if indeed you're referring to requesting the file from a local web serve - check the configuration as many hove suggested. (And check that you're running Apache too.)

Tim Lytle
That's how I read the question as well...
Stobor
A: 

If it means running on Windows .htaccess, use XAMPP and change the hosts file to have the same domain as the web server. Then test is locally.

Wernight