Joomla 2.5 - Adapting Custom URLs with .htaccess o

2019-09-15 19:36发布

问题:

i've just finished a website with a database for golf-holidays. Now the clue is, i am using joomla internal url-rewrite to generate short urls which is generally great, i like it. The only thing left for SEO optimization would be, if i could point an individual URL to each offer listed in the database. A url to a specific offer looks like this :

 http://www.mydomain.com/golfurlaub-mit-greenfee/angebote/urlaubsangebot.html?oid=128

"urlaubsangebot.html" would be the detail site, passed with the parameter "oid" for offerID and then the ID of the offer in my database.

Would it be possible to create a rule / use a tool where i would be agle to assign a custom URL to every offer? For example :

NewURL

http://www.mydomain.com/offers/spain/my-offer-name.html

OldURL

http://www.mydomain.com/golfurlaub-mit-greenfee/angebote/urlaubsangebot.html?oid=128

I tried using tools such as SEF404 and JoomSEF but they rather break my whole structure than help me apply these urls. Any ideas?

回答1:

Joomla 1.6+ is shipped with Redirect Manager (Components > Redirect). It's designed exactly for this purpose (redirecting old urls to new ones).

Joomla 1.6 will include a new component and plugin called Redirect. Its main function is to provide a mechanism to record 404 "not found" errors, and to give the Web site owner the ability to redirect those to another page if desired.

If there are links to your site that result in error 404, these should be already populated in the list when you open the manager - you just have to add new urls to which to redirect to.

References:

  • A preview of link redirection in Joomla 1.6



回答2:

You can use the .htaccess rewrite rules for that:

RewriteEngine On
RewriteRule ^(offers/spain/my-offer-name.html)$ index.php?option=com_mycomponent&oid=128 [L]