Question

I When I call http://www.mysite.in/abc/xyz it should show up http://www.mysite.in/abc/xyz/index.php but the url shout not change in address bar and it should work with out "/" in the address. Please any one help me with .htaccess code for apache 2.2

Note: It should not list the directory content, instead it should show the page. SEO Friendly URL.

Was it helpful?

Solution

1. Without mod_rewrite solution:

Just place this code on top of your .htaccess or in Apache config:

DirectoryIndex index.html index.php

2. mod_rewrite solution:

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(abx/xyz)/?$ $1/index.php [L,NC]

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top