Change rewrite url
I got a problem with the gallery when I changed the setting. However, I noticed that there is an error:
The urls look like such:
main.php / d / number / name.jpg
"number" is dynamic (ie "9496-2")
"name" is dynamic (ie "all + clad + 7pc + b")
Everything else is static.
Unfortunately, when I changed the setting, the "number" part then changed from "9496-2" to "9495-2".
How can I subtract the value "1" from the variable "number"?
Jeff
a source to share
This should do it.
RewriteEngine On
RewriteBase /
RewriteRule ^photos/ebay/main.php/d/([0-9]*)6-([0-9]*)/(.*).jpg /photos/ebay/main.php/d/$1\5-$2/$3.jpg [QSA,L]
I know you said you already have it, but here is a solution without additional script. (And I actually tested this to make sure the \ 5 works).
a source to share
You didn't say which part of your urls is fixed, which parts change, so I'll just be guessing:
RewriteEngine on
RewriteBase /
RewriteRule ^/photos/ebay/main.php/d/9496-2/(.*)$ /photos/ebay/main.php/d/9495-2/$1 [QSA,L]
You can also add R=301
to flags if you want to send a redirect back to clients. (as-is, this should just do an "internal redirect")
a source to share
Here is the solution that worked. It has to do with the use of the .htaccess file and PHP script.
.htaccess file :
Create a .htaccess file with below content:
RewriteEngine On
RewriteBase /
# Redirect to PHP
RewriteRule ^main.php/d/([0-9]*)-([0-9])/(.*)$ scriptName.php?v1=$1&v2=$2&v3=$3 [R=301,QSA,L]
PHP Script:
Create "scriptName.php" and then add to your logic. In my case, I needed to subtract "1" from v1.
NOTE. Make sure .htaccess and PHP script are in the same path.
a source to share