如何优化php页面以在搜索结果中包含用户配置文件页面?
我不知道如何优化profile.php页面以将其包含在搜索结果中。我也试着加入元描述,但什么都没有发生 我在别的地方问过同样的问题,但他们说一定是因为你的.htaccess文件 这是我的.htaccess文件:如何优化php页面以在搜索结果中包含用户配置文件页面?,php,regex,.htaccess,mod-rewrite,Php,Regex,.htaccess,Mod Rewrite,我不知道如何优化profile.php页面以将其包含在搜索结果中。我也试着加入元描述,但什么都没有发生 我在别的地方问过同样的问题,但他们说一定是因为你的.htaccess文件 这是我的.htaccess文件: Options +Indexes # or # IndexIgnore * RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f Re
Options +Indexes
# or #
IndexIgnore *
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9._-]+)$ profile.php?u=$1
RewriteRule ^([a-zA-Z0-9._-]+)/$ profile.php?u=$1
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
实际上你的规则是不正确的
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9._-]+)/?$ profile.php?u=$1 [L,QSA]
你说的优化是什么意思?这和SEO有关系吗?有点像,但我所说的“优化”是指我应该如何处理每个个人资料页面。我有一个问题,我是否应该包括sitemap,因为它是一个社交网站。我没有在你的网站中看到任何特定于sitemap的规则。htaccessit与seo相关,这就是为什么我要问的原因,因为其中会有许多个人资料页面url,所以包括它是否好。好的,在这种情况下,你可以包括任何特定于sitemap的规则,但一定要测试它。