Search code examples
apache.htaccessmod-rewritedirectoryindex

Website link with out “/”


My Apache 2.2 is running on port "8080" I want to call my site url http://www.example.in:8080/abc/xyz.html/index.php (xyz.html is a folder)

as ....

http://www.example.in:8080/abc/xyz.html

Can any one help me with the .htaccess for this..

NOTE:

1) example.in:8080/abc/xyz.html/ is all fine but I want to avoid the "/" at end.

2) I want to avoid DirectorySlash Tried DirectorySlash Off in .htaccess resulted the list of xyz.html folder.

3) Tried DirectorySlash off and Options -indexes RESULTED 403 Forbidden Error

4) Tried with DirectoryIndex index.php RESULT works when "/" is typed but not working without "/" listing the contents ...

Can any one help me with the .htaccess code .. Thanks in advance.


Solution

  • This is how I fixed it

    Added the bellow code to root folder .htaccess

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^(abx/xyz.html)/?$ $1/index.php [L,NC]
    

    And added the bellow code to the .htaccess file in side the xyz.html folder

    DirectorySlash Off
    Directoryindex index.php
    Options -indexes