0

I've the links as follow:

localhost/a/site/watch/contact/

localhost/a/site/details/about/

where .htaccess file is in site folder

All I want to do is remove watch and details from the url like:

localhost/a/site/contact/

localhost/a/site/about/

Update

#Options -Indexes 
#Options         +FollowSymLinks
RewriteEngine   On

#Exclude myadmin directory from the second level links
RewriteRule     ^(myadmin)(/.*)?$ - [L]
RewriteRule     ^(source)(/.*)?$ - [L]

ErrorDocument 404 /404.html

RewriteRule     ^([a-zA-Z0-9_\-]+)/?$    index.php?task=$1 [L]
#Redirect 2nd level links to index.php
RewriteRule     ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$    index.php?task=$1&slug=$2 [L]

#Redirect 3rd level links to index.php
RewriteRule     ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$    index.php?task=$1&slug=$2&page=$3 [L]

#Redirect 4th level links to index.php
RewriteRule     ^([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)?$    index.php?task=$1&slug=$2&title=$3&page=$4 [L]

I've tried following but this doesnot work

#RewriteRule ^/(.*)$ /watch/$1
RewriteBase /a/site
RewriteCond %{HTTP_HOST} ^/watch/
RewriteRule /(.*) /watch/$1 [QSA,L]
RewriteRule /(.*) /details/$1 [QSA,L]
RewriteRule /(.+) /watch/$1/index.php [NC,L]
RewriteCond %{THE_REQUEST} \ /+watch/
RewriteRule ^watch/(.*)$ /$1 [L,R=301]
nasor
  • 371
  • 3
  • 13

1 Answers1

0

Insert these 2 rules just below RewriteEngine On line in /a/site/.htaccess:

RewriteRule ^(contact)/?$ index.php?task=watch&slug=$1 [L,QSA,NC]

RewriteRule ^(about)/?$ index.php?task=details&slug=$1 [L,QSA,NC]
anubhava
  • 664,788
  • 59
  • 469
  • 547