简体   繁体   English

如何获取htaccess文件以允许变量使用句点?

[英]How can I get my htaccess file to allow periods for a variable?

When I go to whats-next/wn_controller.php?user=john.smith , it works. 当我转到whats-next/wn_controller.php?user=john.smith ,它可以工作。 But when I go to whats-next/john.smith , it doesn't work. 但是当我转到whats-next/john.smith ,它不起作用。

I've tried to this line: 我尝试过这一行:

RewriteRule ^whats-next/([A-Za-z0-9-_]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

to this: 对此:

RewriteRule ^whats-next/([A-Za-z0-9-\._]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

and this: 和这个:

RewriteRule ^whats-next/([A-Za-z0-9-._]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles

But it hasn't fixed it. 但这还没有解决。

Here is my full .htacess file is listed below. 这是我的完整.htacess文件在下面列出。

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)$

#RLA Page
RewriteRule ^about/$ whats-next/wn_controller.php [NC,L] # Process about
RewriteRule ^about$ whats-next/wn_controller.php [NC,L] # Process about ##WITHOUT TRAILING DASH URL TOO. FIX SOMEDAY

#What's Next User
RewriteRule ^whats-next/community/$ whats-next/wn_controller.php [NC,L] # Process community
RewriteRule ^whats-next/follow-up/$ whats-next/wn_controller.php [NC,L] # Process follow-up
RewriteRule ^whats-next/people/$ whats-next/wn_controller.php [NC,L] # Process people
RewriteRule ^whats-next/messages/$ whats-next/wn_controller.php [NC,L] # Process messages
RewriteRule ^whats-next/messages([A-Za-z0-9-]+)$ whats-next/wn_controller.php?message=$1 [NC,L] # Process messages
RewriteRule ^whats-next/([A-Za-z0-9-_]+)$ whats-next/wn_controller.php?user=$1 [NC,L] # Process profiles
RewriteRule ^whats-next/settings/$ whats-next/wn_controller.php?user=$1 [NC,L] # Process settings

#What's Next Admin
RewriteRule ^whats-next/admin/$ whats-next/wn_controller.php [NC,L] # Process profiles
RewriteRule ^whats-next/admin$ whats-next/wn_controller.php [NC,L] # Process profiles ##WITHOUT DASH TOO. FIX SOMEDAY

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Try to remove your dash right after 0-9 . 尝试在0-9之后立即删除破折号。

This worked for me: ^whats-next/([A-Za-z0-9._]+)$ 这对我^whats-next/([A-Za-z0-9._]+)$^whats-next/([A-Za-z0-9._]+)$

在此处输入图片说明

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

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