Why does not work RewriteRule or RewriteCond in Wordpress?

RewriteEngine On
RewriteCond %{HTTPS} =off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]

#redirect for saves
RewriteCond %{REQUEST_URI} ^s/
#RewriteRule ^(.*)/$ /$1 [R=301]
RewriteRule /s/(.*)$ /wp-content/themes/iconic-one/function/save/index.php?id=$1 [L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

with references of the form site.ru/s/gram the redirect is not happening. Writes: nothing found!
April 7th 20 at 10:48
1 answer
April 7th 20 at 10:50
RewriteRule /s/(.*)$

Line which works RewriteRule does not start with /
https://habr.com/en/company/sprinthost/blog/129560/

RewriteRule ^s/(.*)$ /wp-content/themes/iconic-one/function/save/index.php?id=$1 [L]
'REQUEST_URI'
The URI which was provided to access this page. For example, '/index.html'. - brice_Skiles commented on April 7th 20 at 10:53
It is from the official documentation. As You have doesn't work either. - brice_Skiles commented on April 7th 20 at 10:56
@brice_Skiles, it's usually necessary to put above the WordPress rules
RewriteRule ^s/(.*)$ /wp-content/themes/iconic-one/function/save/index.php?id=$1 [L]

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
- Reymundo.Goldner commented on April 7th 20 at 10:59
@Reymundo.Goldner, and did from the beginning, but not working. - brice_Skiles commented on April 7th 20 at 11:02
@brice_Skiles, as now seems content .htaccess
We need to check that the path "/wp-content/themes/iconic-one/function/save/index.php"
You can check by requesting a script with the necessary parameters directly from browser.
/wp-content/themes/iconic-one/function/save/index.php?id=gram
- Reymundo.Goldner commented on April 7th 20 at 11:05
@Reymundo.Goldner, Posted full .htaccess . The path is correct. - brice_Skiles commented on April 7th 20 at 11:08
RewriteEngine On
RewriteCond %{HTTPS} =off 
RewriteRule (.*) <a href="https://%{HTTP_HOST}%{REQUEST_URI}">https://%{HTTP_HOST}%{REQUEST_URI}</a> [QSA,L]

#redirect for saves
RewriteRule ^s/(.*)$ /wp-content/themes/iconic-one/function/save/index.php?id=$1 [L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
- Reymundo.Goldner commented on April 7th 20 at 11:11
@Reymundo.Goldner, in this file I wrote code 500 . Although the page referenced by the redirect works. - brice_Skiles commented on April 7th 20 at 11:14
@brice_Skiles, error 500 only for queries of the form site.ru/s/gram or for all pages?
And we need to see what Apache writes in the error.log during the 500 error. - Reymundo.Goldner commented on April 7th 20 at 11:17
@Reymundo.Goldner, only for site.ru/s/gram . The hosting site, not sure what to log Apache access. - brice_Skiles commented on April 7th 20 at 11:20
@brice_Skiles, well, usually near the access.log is and error.log apache. - Reymundo.Goldner commented on April 7th 20 at 11:23

Find more questions by tags htaccess