NameSilo

Mod rewrite help please

Spaceship Spaceship
Watch

blue^ray

Account Closed
Impact
5
Hi, basically what I want to do is manually rewrite the url's in the .htaccess file.


does anyone know how I can tell the .htaccess file to rename this specific url

"http://www.ausxmods.com.au/index.php?main_page=product_info&cPath=88&products_id=189&zenid=28fe166ecc88e477a2978fc1aa825798"

to

"http://www.ausxmods.com.au/sony-psp/30-seconds-to-mars/"

and tell it when people visit the old link to redirect them to the new link.

my website does not have many products so I can easily manually rewrite everything. is this possible?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
1) 30 seconds to mars = Fairly good :)

2) What you want to do here is not actually mod_rewrite, it would be redirection. With mod_rewrite you actually take for example a row ID from the query string and then work with that as you would normally. Since your new url has no direct relation to the old url you can't work with mod_rewrite without some type of page to take an id, grab the (category?) song-psp and (title?) 30-seconds-to-mars.

Simple redirection would just be:

Code:
Redirect 301 /index.php?main_page=product_info&cPath=88&products_id=189&zenid=28fe166ecc88e477a2978fc1aa825798 [url]http://www.ausxmods.com.au/sony-psp/30-seconds-to-mars/[/url]

301 = Permenant. (you can indeed use the keyword 'pemenant' instead of 301 if you wish, or not at all)

Matt
 
Last edited:
0
•••
Code:
RewriteEngine on
RewriteRule ^([0-9]+)/([0-9]+)(/.*)? index.php?main_page=product_info&cPath=$1&products_id=$2
That's what I would do. Just make the first number the cPath and the second number the product id. Then you can have whatever after that if you want to do some SEO type stuff. (site.com/cPath/products_id/anything-can-be-here)

You could also add a column in your database to be the URL value like 30-seconds-to-mars, then match that and get the data. [So you wouldn't need the first two numbers.]
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back