htaccess重定向不工作参数任何想法?

时间:2018-03-07 13:11:10

标签: php .htaccess

.htaccess重定向无法正常工作。以下是我目前的.htaccess文件的任何想法?

Options -Indexes
DirectoryIndex index.php
Options +FollowSymlinks
RewriteEngine on
RewriteBase /mu
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^www\. [NC]
Redirect 301 ^/Bilet\.php$ https://www.sitename.com.tr/mu
Redirect 301 ^/SSS\.html$ https://www.sitename.com.tr/mu/sss
Redirect 301 ^/ik\.php$ https://www.sitename.com.tr/mu/kurumsal/insan-kaynaklari

1 个答案:

答案 0 :(得分:1)

这是使用https强制重定向进行301重定向的精细.htaccess文件。

  

请说明您是否使用任何框架

# Turn on URL rewriting
RewriteEngine On

# Installation directory
#RewriteBase /mu

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php[^/] /$1? [L,R=301,NC,NE]

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php(?:/(.*))?$ /$1$2? [L,R=301,NC,NE]

RewriteCond %{THE_REQUEST} /index.php [NC]
RewriteRule ^(.*)index\.php$ /$1/ [R=301,L,NC,NE]


# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php/$0 [PT,L]

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?!localhost$|127\.0\.0\.1$)(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L,NE]   


Redirect 301 /Bilet.php /mu
Redirect 301 /SSS.php /mu/sss
Redirect 301 /ik.php /mu/kurumsal/insan-kaynaklari