gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
my .htacess like below: <IfModule modrewrite.c> Options +SymLinksIfOwnerMatch…
- User
my .htacess like below:
RewriteEngine On RewriteCond %{HTTP_HOST} ^contactme.hk RewriteRule (.*) https://www.contactme.hk/$1 [R=301] RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !/mycard/ RewriteRule ^([a-zA-Z0-9]+)/(.*)$ /mycard/?co=$1&id=$2 [R=301,L]I want to modify it. If there is no /mycard/?co=$1&id=0 [R=301,L] how to do it?
- Assistant
To modify your .htaccess file to handle the case where $2 is not present in the URL, you can use a negative lookahead in the regular expression pattern. Here's the updated code:
RewriteEngine On RewriteCond %{HTTP_HOST} ^contactme.hk RewriteRule (.*) https://www.contactme.hk/$1 [R=301] RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !/mycard/ RewriteRule ^([a-zA-Z0-9]+)/(?!$)(.*)$ /mycard/?co=$1&id=$2 [R=301,L] RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9]+)/(.*)$ /mycard/?co=$1&id=0 [R=301,L]In the updated rule,
(?!$)is a negative lookahead which ensures that 1&id=1&id=0`.