简体   繁体   English

Apache 2.4 .htaccess PHP无法正常工作

[英]Apache 2.4 .htaccess PHP Not Working

I have spent my whole day trying to make this work, and I cannot make it happen. 我花了整整一天的时间来尝试完成这项工作,但我无法实现。

I have a server with GoDaddy where I test websites I create. 我在GoDaddy上有一台服务器,用于测试我创建的网站。 I am trying to work on a friendly-url system with htaccess, and it will not work. 我正在尝试使用htaccess的友好URL系统,但是它不起作用。

The file is saved on the folder eureka It looks like this: 该文件保存在eureka文件夹中,如下所示:

RewriteEngine On

RewriteRule trips/([0-9]+) trip_details.php?trip_id=$1 [NC,L]

When someone goes to http://www.jseeh.com/eureka/trips/22 I want them to be redirected to http://www.jseeh.com/eureka/trip_details.php?trip_id=22 当有人访问http://www.jseeh.com/eureka/trips/22时,我希望将他们重定向到http://www.jseeh.com/eureka/trip_details.php?trip_id=22

Any help will be greatly appreciated 任何帮助将不胜感激

it looks like you're omitting the eureka directory. 看来您正在省略eureka目录。 try something like this and see if it works 尝试这样的事情,看看是否可行

RewriteRule ^/eureka/trips/([0-9]+)\/? eureka/trip_details.php?trip_id=$1 [L]

Edit: New answer based on OP's reply below. 编辑:根据OP在下面的答复的新答案。 Tested and working on Apache with your directory setup. 在目录设置下测试并使用Apache。

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /eureka

RewriteRule trips/([0-9]+)\/? trip_details.php?trip_id=$1 [L]

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

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