Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

htaccess Redirect to index.php - please help

htaccess redirect

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 amir2000


    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 09 January 2013 - 12:19 AM

Hi all,

I got the following code:
# Redirect index in any directory to root of that directory
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.[^\ ]*\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(php|html?)$ http://www.example.com/$1? [R=301,L]

I want to get exactly the opposite:

Instead of http://www.example.com/ I would like to get http://www.example.com/index.php but also to all directories and sub directories (http://www.example.c...ature/index.php).
And is it then solving the problem of Duplicate meta descriptions ?

Thanks in advance,

#2 mortezaipo


    CC Lurker

  • New Member
  • Pip
  • 6 posts

Posted 13 January 2013 - 10:01 PM

Try it :

RewriteEngine on
RewriteCond $1 !^(index\.php|inc|images)
RewriteRule ^(.*)$ /index.php/$1 [L]

Note: if your root directory isn't at www . like it : /var/www/code/mywebsite , you should change "/index.php" to "/code/mywebsite/index.php"!
means :
RewriteRule ^(.*)$ /code/mywebsite/index.php/$1 [L]

Edited by mortezaipo, 13 January 2013 - 10:07 PM.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download