简体   繁体   English

重写规则有问题

[英]Having issues with Rewrite Rules

How do I make htaccess include the post name when rewriting the url? 重写网址时,如何使htaccess包含帖子名称? Currently I am using a code-canyon purchased platform which does not come with SEO Friendly urls how ever the product is amazing otherwise. 目前,我使用的是购自代码峡谷的平台,该平台不附带SEO友好网址,否则该产品会令人赞叹。

Here is the code before any htaccess changes. 这是任何htaccess更改之前的代码。

<a href="'.$this->url.'/index.php?a=track&id='.$row['id'].'" id="song-url'.$row['id'].'" target="_blank">'.$this->title.'</a>

I am looking to get my tracks page "Which is the content page in this example" to display in the url something like http://www.example.com/tracks/song-name-here but instead it displays something like this http://www.example.com/index.php?a=track&id= and the ID Does not even generate the post name it's just a random number. 我希望获得我的跟踪页面“此示例中的内容页面”,以在url中显示类似http://www.example.com/tracks/song-name-here的内容,但是却显示类似http的内容://www.example.com/index.php?a = track&id =和ID甚至不会生成帖子名称,它只是一个随机数。

Here is my current rewrite rules for the url http://www.example.com/index.php?a=track&id= 这是我当前对网址http://www.example.com/index.php?a=track&id=的重写规则

RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?a=$1&id=$2 [L]

You can check out the product in which I have purchased over at http://codecanyon.net/item/phpsound-music-sharing-platform/9016117 if you would like more information to help me out. 如果您想了解更多信息,可以在http://codecanyon.net/item/phpsound-music-sharing-platform/9016117上查看我购买的产品。

You cannot do this without adding this functionality to the PHP code you are using. 如果不将此功能添加到正在使用的PHP代码中,则无法执行此操作。 I clicked the "support" tab on the codecanyon.net page and the author clearly states in the FAQ: 我单击了codecanyon.net页面上的“支持”选项卡,并且作者在FAQ中明确指出:

URL's rewrite Due to multiple server environment which requires different rewrite url's I decided not to include this feature at the moment (it can be easily implemented), however this feature will be taken in consideration for implementation in further updates. URL的重写由于多服务器环境需要不同的重写URL,因此我决定暂时不包括此功能(可以轻松实现),但是在进一步更新中将考虑使用此功能。

You cannot do this with rewrite rules only - the software needs to maintain a own 1-1 mapping of SEO-friendly URLs to ugly URLs. 您不能仅使用重写规则来执行此操作-软件需要维护自己的1-1 SEO友好URL到丑陋URL的映射。 Most frameworks and CMS like Wordpress, Drupal, etc, provide this as a feature. 大多数框架和CMS(如Wordpress,Drupal等)都将其作为功能。 PhpSound explicitly does not offer this functionality. PhpSound明确不提供此功能。

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

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