Dynadot โ€” .com Registration $8.99

Mod rewrite help needed

Spaceship Spaceship
Watch
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
This would be difficult with mod_rewrite since you don't have a 1 to 1 mapping between the original and rewritten URLs. You might need to use a PHP script instead of (or in conjunction with) mod_rewrite to do the mapping (e.g. from category-name to id)
 
0
•••
0
•••
If you can modify the category.php and vide.php scripts to take a category name or a title instead of an id, then you might try the following:

Code:
RewriteEngine on

RewriteRule ^category/([^/]+)/page([0-9]+)$  category.php?name=$1&page=$2 [L]
RewriteRule ^view/([^/]+)$ view.php?title=$1 [L]
 
0
•••
Thanks dude. I will let you know the outcome of it.
 
0
•••
0
•••
If you can modify the category.php and vide.php scripts to take a category name or a title instead of an id, then you might try the following:

Code:
RewriteEngine on

RewriteRule ^category/([^/]+)/page([0-9]+)$  category.php?name=$1&page=$2 [L]
RewriteRule ^view/([^/]+)$ view.php?title=$1 [L]

The view one worked, but the category one did not work. It says page not found.
 
0
•••
0
•••
Okay, it works now. But it bugs out if I don't have /page1. Can I have it default to being page1 if a page isn't inputted?
 
0
•••
Add another rule:

Code:
RewriteRule ^category/([^/]+)$  category.php?name=$1&page=1 [L]
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back