can't use any htaccess at all
Posted by: seco (---.232.231.242.tedata.net)
Date: March 30, 2008 05:48AM

Hi
i try any htaccess at any script i get this error
internal server error
i goto apache modules menu and enable te mod_rewrite and also ssl_module and now when i open the page it says unable to connect !!

any help how to enable htaccess work?



Edited 1 time(s). Last edit at 03/30/2008 05:48AM by seco.

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.242.tedata.net)
Date: March 31, 2008 10:21AM

any help?

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: March 31, 2008 02:46PM

try simple one first
# .htaccess file
AuthUserFile c:/wamp/www/your_test_folder/.htpasswd
AuthName "Private Area"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

# .htpasswd file
user:pass

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.242.tedata.net)
Date: March 31, 2008 07:03PM

i try my htaccess on another server and it works well
why wamp doesn't do it?

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: March 31, 2008 08:27PM

You meant on your host? Most host mostly setup most things people often use, but w/ wamp you have to setup yourself depends on what you need

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.151.tedata.net)
Date: April 01, 2008 11:25AM

all i want to do is to make wamp accept htaccess files like other servers

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: April 02, 2008 02:52PM

Not sure if you're so simple or really don't understand, and assume you're simple, so here is the simple answer for you:

htaccess work like main config file but only apply to particular folder or user instead the whole web server like main config file, so if you want htaccess work like your host, you have to request your host to provide you all settings they have for your plan, so you can implement wamp to work like your host ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.122.tedata.net)
Date: April 02, 2008 04:27PM

i said again
i try the htaccess file on another server and it works but the same file doesn't work on wamp
any ideas or help?

thanks in advance.

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: beevee (---.schoo1.lb.home.nl)
Date: April 02, 2008 11:20PM

Hi Seco,

Did you check if mod_rewrite is run by apache?

- Click on the WampServer icon, select Apache, Apache modules
- Scroll down until you see 'Rewrite_Module'
- If there is no check mark before Rewrite_Module click on it to enable it.

Now things should work (I am not sure if you have to restart the Apache service, just try)

-- Benny

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.122.tedata.net)
Date: April 02, 2008 11:35PM

when i make mod_rewrite the server gives me unable to connect and can't view the page
im asking if any one try to work htaccess on wamp server? i need help

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: beevee (---.schoo1.lb.home.nl)
Date: April 02, 2008 11:53PM

gives the server also an error when you (for the sake of the test) disable the .htaccess file (by renaming it temporary)? If not I would think the .htaccess file is being parsed but mod_rewrite is having some troubles with it

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: April 03, 2008 12:38AM

The easiest way to find out is running a simple test; for example:

<!-- test1.html -->
<html>
   <body>
      <p>
         This is Test 1
      </p>
   </body>
</html>


<!-- test2.html -->
<html>
   <body>
      <p>
         This is Test 2
      </p>
   </body>
</html>


# .htaccess
RewriteEngine on
RewriteRule ^test1.html$ test2.html

Save these 3 files as test1.html, test2.html and .htaccess in folder c:/wamp/www/testRewrite and access as follows:

http:// localhost/testRewrite/test1.html

If you've already enabled mod_rewrite, you should see the result of test2.html which is "This is test 2"

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: beevee (---.schoo1.lb.home.nl)
Date: April 03, 2008 01:01AM

are you using an alias? ...if so then you might need to add "RewriteBase /nameofalias" between lines 01 and 02 of the sample yfastud just gave

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: seco (---.232.231.122.tedata.net)
Date: April 03, 2008 05:56AM

the example of yfastud works test1.php goes to dd/test2.php successfully but all the links on the page that goes to dd/test2.php renamed to test2.php which is of course not at that path !!
it renames all links that goes to dd/test2.php to test2.php !!!
any idea why? what is the solution?

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: April 03, 2008 01:10PM

Hey seco
Your mod_rewrite works, so you should get some books or/and join some other forums that are more about coding to help you achieve your goals ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: sheetal (---.129.93.111.tataidc.co.in)
Date: June 18, 2010 09:29AM

Hello yfastud ,

I have tested example of test1.html and test2.html u have given above,its working.But I want to hide php extension by html extension.

I have used this rule in htaccess->

RewriteRule ^(.*)\.htm$ $1.php [nc]

its working for html extension .But it also works for php extension.I want to hide php extension.
Ur help is needed.

Thanks,
Sheetal

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: yfastud (Moderator)
Date: June 19, 2010 05:17PM

Put/embed your php script inside html file(s); for example:

<!-- test1.html -->
<html>
   <body>
      <p>
         This is Test 1
      </p>
   </body>
</html>


<!-- test2.html -->
<html>
   <body>
      <p>
         This is Test 2
      </p>
      <?php
      echo "And this is generated from PHP";
      ?>
   </body>
</html>

Then put this line of code in your htaccess file:

AddType application/x-httpd-php .html

And for testing this, your htaccess should be as follows:

# .htaccess

# Embed PHP in HTML
AddType application/x-httpd-php .html

# Rewrite rules
RewriteEngine on
RewriteRule ^test1.html$ test2.html

Save these 3 files as test1.html, test2.html and .htaccess in folder c:/wamp/www/testRewrite and access as follows:

http:// localhost/testRewrite/test1.html

If you've already enabled mod_rewrite through wamp tray icon, you should see the result of test2.html as follows:

This is test 2

And this is generated from PHP



Even when select view source code in browser, you only see html codes winking smiley

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: sheetal (---.129.93.111.tataidc.co.in)
Date: June 21, 2010 09:12AM

Hello yfastud ,

Thanks for reply.

But problem is that in my folder all files are php files(.php) and I don't want to show php extension on address bar while accessing files.

If I explicitly write php extension file on addressbar , I want to display error as "The requested URL filename.php was not found on this server "even if php files exsists inside folder.

Is there any htaccess rule for that?

Thanks,
Sheetal

Options: ReplyQuote
Re: can't use any htaccess at all
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: June 21, 2010 07:05PM

The following rule will direct all requests for a .html file to its corresponding .php file
RewriteRule ^(.*)\.htm$ $1.php [nc]

Eg if you go to mysite.com/hello.html it will actually call mysite.com/hello.php

You wont be able prevent complete access to your .php files. If you're trying to protect yourself from hackers, I doubt you'll fool a hacker into thinking your site is just plain old html because your urls end in .html

Options: ReplyQuote


Sorry, only registered users may post in this forum.