simon
simon

Reputation: 11

HTACCESS | Social Engine | Stop redirecting Root index

I have a install of SocialEngine currently and all urls are processed by .htaccess file that redirects through to the socialengine.php file and processes nice URLs etc.

I am wanting to stop example.com/ been redirected through to the script as I am wanting to put a different index page there. So I want my .htaccess file to process every other file it cant find through the socialengine.php script but keep the root file going to index.php.

So if it’s .com/ it goes to index.php and if it’s anything else it’s processed through the socialengine.php.

Below is my .htaccess file that requires alteration.

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine On
  # Get rid of index.php
  RewriteCond %{REQUEST_URI} /socialengine\.php
  RewriteRule (.*) socialengine.php?rewrite=2 [L,QSA]
  # Rewrite all directory-looking urls
  RewriteCond %{REQUEST_URI} /$

  RewriteRule (.*) socialengine.php?rewrite=1 [L,QSA]
  # Try to route missing files
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} public\/ [OR]
  RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
  RewriteRule . - [L]

  # If the file doesn't exist, rewrite to index
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ socialengine.php?rewrite=1 [L,QSA]
</IfModule>

Thanks in advance for any replies.

Upvotes: 1

Views: 4809

Answers (1)

Lekensteyn
Lekensteyn

Reputation: 66465

Put the code below straight after RewriteEngine On.

RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* - [L]

Explanation: The first line matches a request to http://example.com/ (REQUEST_URI contains / in this case). The second line passes the request untouched (note the -)

References:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

Upvotes: 2

Related Questions