user1373161
user1373161

Reputation:

always have issues with htaccess

I am trying to short out one issue with my htaccess.

   RewriteBase /
   RewriteRule ^(.+)/$ /$1 [R=301,L]
   RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA]
   RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA]

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d 
   RewriteRule ^index.php$ /index.php [L,NC]

it work fine as long as there is profile or industry match.. but now what i want to achieve is when above no rule matches then it should redirect user to home page (www.example.com). what is happening is it redirect me to index.php but the problem is on browser it still shows (www.example.com/skfjsf/sfjsfk) i want to change it to (www.example.com)

Upvotes: 0

Views: 45

Answers (1)

PolCPP
PolCPP

Reputation: 136

Try:

RewriteRule ^index.php$ /index.php [r=301,nc]      

//instead of 

RewriteRule ^index.php$ /index.php [L,NC]

Upvotes: 1

Related Questions