将 URL for blog-detail.php/{slug} 重写为 blog-detail/{slug}
Rewrite URL for blog-detail.php/{slug} into blog-detail/{slug}
我已经成功地将 www.my-website/blog.php 重写为 www.my-website/blog
现在,我想对我的 blog-detail.php 页面做进一步的事情
从 www.my-website/blog-detail.php/how-seo-works 到 www.my-website/blog-detail/how-seo-works
'how-seo-works' 是我的鼻涕虫,它可以是任何东西取决于文章的标题
当我尝试 www.my-website/blog-detail/how-seo-works
错误是内部服务器错误
这是我的 htaccess:
# Run Php without filename extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ .php
# Return 404 if original request is .php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
网站出现错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at you@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
在错误日志中:
AH00124:由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,使用 'LimitInternalRecursion' 增加限制。使用 'LogLevel debug' 获取回溯。, referer: http://localhost:8080/my-website/blog
我已经解决了这个问题。
所以,这是我修改后的 .htaccess 以访问 my-website/blog-detail/how-seo-work
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ .php
RewriteRule ^blog-detail/([0-9a-zA-Z-]+) blog-detail.php?id= [L,QSA]
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
我已经成功地将 www.my-website/blog.php 重写为 www.my-website/blog
现在,我想对我的 blog-detail.php 页面做进一步的事情 从 www.my-website/blog-detail.php/how-seo-works 到 www.my-website/blog-detail/how-seo-works
'how-seo-works' 是我的鼻涕虫,它可以是任何东西取决于文章的标题
当我尝试 www.my-website/blog-detail/how-seo-works 错误是内部服务器错误
这是我的 htaccess:
# Run Php without filename extension
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ .php
# Return 404 if original request is .php
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]
网站出现错误:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at you@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
在错误日志中: AH00124:由于可能的配置错误,请求超出了 10 个内部重定向的限制。如有必要,使用 'LimitInternalRecursion' 增加限制。使用 'LogLevel debug' 获取回溯。, referer: http://localhost:8080/my-website/blog
我已经解决了这个问题。
所以,这是我修改后的 .htaccess 以访问 my-website/blog-detail/how-seo-work
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ .php
RewriteRule ^blog-detail/([0-9a-zA-Z-]+) blog-detail.php?id= [L,QSA]
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
RewriteRule .* - [L,R=404]