简体   繁体   English

在Godaddy动态php页面上重写URL

[英]url rewrite on godaddy dynamic php pages

I am trying to do a url rewrite for php dynamic pages. 我正在尝试为php动态页面进行URL重写。 The rewrite sends them to the page but I am getting a 404 error. 重写将它们发送到页面,但出现404错误。 In my php page i use $coinshow =$_REQUEST['coinshow']; 在我的php页面中,我使用$ coinshow = $ _ REQUEST ['coinshow'];

I want to to go from sitename.com/coinShowPage.php?coinshow=XyzShow to sitename.com/XyzShow or I would be happy with sitename.com/coinshows/XyzShow too. 我想从sitename.com/coinShowPage.php?coinshow=XyzShow转到sitename.com/XyzShow,否则我也对sitename.com/coinshows/XyzShow感到满意。

Please note coinShowPage.php is the only page I need redirected. 请注意,coinShowPage.php是我需要重定向的唯一页面。

Here is the .htaccess file 这是.htaccess文件

RewriteEngine On<br>
RewriteCond %{THE_REQUEST} ^[A-Za-z]{3,}\s/+coinShowPage\.php\?coinshow=([^\s]+) [NC]
RewriteRule ^ http://www.SiteName.com/%1? [R=301,L]

I already tried the following and it did not work 我已经尝试了以下方法,但没有用

RewriteEngine On
Options +FollowSymlinks -MultiViews -Indexes
RewriteBase /
RewriteRule ^/([0-9]+)/?$ coinShowPage.php?coinshow=$1 [NC,L]

Any help would be greatly appreciated. 任何帮助将不胜感激。

Try this: 尝试这个:

Options +FollowSymlinks -MultiViews -Indexes

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Za-z]{3,}\s/+coinShowPage\.php\?coinshow=([^\s]+) [NC]
RewriteRule ^ http://www.SiteName.com/%1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ coinShowPage.php?coinshow=$1 [QSA,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM