Forum Moderators: phranque

Message Too Old, No Replies

How do i write in in htaccess?

         

zaira_86

6:56 pm on Mar 18, 2010 (gmt 0)

10+ Year Member



Hi, i have an ssl installed in my website. Then, i only want the ssl to work on some pages like registration and login page. Any idea please on how to do that?

And then, also. What am i going to do in htaccess too that everytime i will open index.php or index.html the link in the addressbar will automatically change into [mysiteexample.com....] Basically, just automatically remove index.php or index.html in the link.

g1smd

7:04 pm on Mar 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Link to a URL ending in / so that user sees a URL ending in / when they click it.

DirectoryIndex index.php
will take care of serving the right file for that request (or you could add an internal rewrite to make it work).

Set up a redirect for users that do request the index file by name, redirecting to the canonical domain as well as removing the index filename from the target URL. Also set up your standard non-www to www canonicalisation redirect.

Yes, set up redirects to redirect to HTTP for requests that should not be HTTPS, and to HTTPS for requests that should not be HTTP. That's vital, and you need BOTH.

zaira_86

7:15 pm on Mar 18, 2010 (gmt 0)

10+ Year Member



Thanks for the reply.

How do i add make an internal rewrite? How do i set up a redirect for each user?

jdMorgan

12:44 pm on Mar 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Zaira,

Please see the resources cited in our Apache Forum Charter, and read the Charter itself to find out how to get the most from this forum.

Our Apache Forum Library also contains tutorials and example threads.

Our site search function can be used to find threads with example code for specific applications.

Links to these resources are at the top of this page.

This recent thread [webmasterworld.com] includes code to handle SSL/non-SSL redirection.

Taking the time to study redirection, mod_rewrite, and .htaccess directives is well worth your time. Since this is server configuration code, and not to be trifled with. It must be *exactly* correct; One single typo or a small logic error can cause disastrous results for the rankings of your pages and the correct operation of your server.

Do not rely on .htaccess or script-based redirects to control the URL displayed in the browser. Doing so results in the browser having to make multiple requests to get one 'page' and can affect your pages' ability to rank well in search engines as well as making your 'stats' inaccurate and unusable for meaningful marketing analysis. Instead, check all of the links that you publish on your pages, and make sure that each links to the correct final destination URL.

Jim