example.com/contact.php <- I want to like this -> example.com/contact
,这也想...删除尾随斜线的子目录的URL索引
example.com/contact/ (havent real directory. want to redirect /contact)
example.com/contact.(any extension redirect to /contact)
我想这样的.. plz帮助我,这一个
如果有真正想要的目录去那里......
编辑:
example.com/watch.php?id=1995/english-videos
这个环节是不行的..我想与r像这样的转接example.com/contact
不想要斜线。我想工作这个环节example.com/watch.php?id=1995/english-videos
/.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^col3negmovie.com$
RewriteRule ^(.*)$ "http\:\/\/www\.col3negmovie\.com\/$1" [R=301,L]
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase/
RewriteCond %{HTTP_HOST} ^col3negmovie\.com$
RewriteRule ^(.*)$ http://www.col3negmovie.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+watchnew1\.php\?id=([^\s&]+) [NC]
RewriteRule^watch/%1? [R=301,L]
RewriteRule ^watch/(.+?)/?$ watchnew1.php?id=$1 [L,QSA,NC]
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L]
# remove .php extension
RewriteCond %{THE_REQUEST} \s/+(.*?)\.php[\s?] [NC]
RewriteRule^/%1 [R=301,L,NE]
# add .php extension internally
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ /$1.php [L]
example.com/watch.php?id=1995/english-videos
不工作:(其他链接,我想这样的example.com/contact
,example.com/about
但这个环节要像
为什么你想从实际目录中删除尾部斜杠?这是很大的安全性r isk如果该目录没有默认的'index.php'。 – anubhava
哎呀!为什么?什么问题?你能否描述我 – user3501407
我已经写过这个风险的原因。 – anubhava