0

「stuff」のページ 2 に www.website.com/stuff/page?=2 の代わりに www.website.com/stuff/2 を使用する可能性が非常に高いことはわかっています。しかし、どうすればそれを行うことができますか?何を検索すればよいかわかりません。

パラメータを取得するために PHP と $_GET を使用していると編集してください。これは非常に広く使われているので、それほど難しいとは思いませんでした。

4

3 に答える 3

2

There are 3 common ways:

  1. Rewrite the URL internally from .../2 to .../?page=2.

  2. Use the "path info" mechanism of your web language. A script at /stuff/index.xyz would have a path info of 2 with the given URL.

  3. Have the web program capture all URLs and use routing to determine which function to call and what values to pass it.

于 2013-06-10T00:02:40.990 に答える
1

それはすべて、使用しているものに依存します。

PHP ? apache .htaccess URL Rewritingを探していると思います

于 2013-06-09T23:59:30.507 に答える
0

はい、.htaccess で単純な mod_rewrite ルールを使用することで、ほとんどの場合可能です。mod_rewrite と .htaccess を有効にしてからhttpd.conf、このコードをディレクトリの.htaccess下に配置します。DOCUMENT_ROOT

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(stuff)/([^/]+)/?$ /$1.php?page=$2 [L,QSA,NC]
于 2013-06-10T01:38:07.650 に答える