I am trying to make more friendly the urls of my joomla site. Currently, a typical url is like this: www.mysite.com/index.php?option=com_content&view=article&id=5&Itemid=10&hotel=182.
I would like to have a url like the following: www.mysite.com/hotel_name, where the value of hotel_name will be the value of the field 'hotel_name' in my DB! What are the required processes in the .htaccess file in order to achieve that?
After you turn on SEF, structure of url is set based on router.php file in component's folder. ( com_content/router.php. )
Or you can use component to make your own url http://extensions.joomla.org/extensions/site-management/sef
Depending on which webserver (Apache, Nginx, etc) you are using there is a tutorial for that
http://docs.joomla.org/Enabling_Search_Engine_Friendly_%28SEF%29_URLs
Related
I've got an odd redirect request, and I'm not sure if it is possible.
On the server we have a series of PHP files with a name similar to /title-of-the-page-####.php, where #### is an unique integer ID of the page.
I want to be able to redirect users from /#### to the full title of the page (as listed above). Is this possible from within an .htaccess file, and if so, how? (I would like to avoid listing all of the pages from within the .htaccess file)
My URL looks like this:
http://kanchannews.com/news/news-details/103/Top-5-Mind-Blowing-Facts-You-Know-
About-Samsung
What i want to show is like:
http://kanchannews.com/news/Top-5-Mind-Blowing-Facts-You-Know-About-Samsung
Can I get this kind of url using htaccess? I'm using codeigniter for this projects.
This will be done, with CI Routes. The problem you'll have is not having the ID of the post in your URL. If the title is also unique, you'll be fine.
$route['news/(:any)'] = 'news/news_by_title/$1';
This will re-route everything to a "news_by_title" method within your news controller, which you'll need to query the database using the title.
http://www.codeigniter.com/userguide3/general/routing.html
I would like to add a line to my htaccess to change this url:
RewriteEngine on
do this is the url
http://site/Calendar/viewevent?eventid=9223
into something like this :
http://site/Calendar/viewevent/Title-of-event
its php and joomla and I am a php developer, please dont advise me to use a component or module to handle redirects, I am trying to achieve this using .htaccess ONLY :) thank you in advance!!
Your 'pretty' url contains information that is not in the 'working' url. Besides that, the 'working' url also contains information that is not in the pretty url. You need database access to translate the event id to a seo-title, and the seo-title back to an event id. In other words: It is impossible to do this with .htaccess only, unless you change 'viewevent' to accept an event by seo-title, instead of eventid.
Mod_dbd can possible be used, but only in the server config file, not .htaccess.
As Sumurai8 says htaccess cant transform url like you want automatically.
But you can use Redirect 301 (or its variation) for one url to another.
for your example:
Redirect 301 /Calendar/viewevent?eventid=9223 /Calendar/viewevent/Title-of-event
more information here
how can i view the real URL without the functionality of .htaccess rewrite file ?
while using url rewrite with the .htaccess file you able to see sites like this :
example.com/i/154/b/6574534
i want to see the "source" of the url , such as
example.com/index.php?i=15&b=6574534
It sounds like you want to reverse the URL rewriting, without having server-level access to the server you are interested in. If this is the case, what you're asking for is not possible unless the server provides an API, a custom HTTP header in the response, another link on the page, or some other method to find the non-rewritten URL. The ability to do otherwise would defeat many purposes of URL rewriting.
I want to move the website to the Drupal CMS with original paths. It's look like
website.com/search.php?q=blablabla
website.com/index.php?q=blablabla
website.com/category.php?q=auto&page=2
etc
How can i use these aliases in Drupal? Thank you.
I think you will have great difficulty setting this up, if it's even possible. It would be much better to let Drupal use its standard clean URLs and to setup URL rewrite rules to translate requests for legacy URLs to the new ones.
For example, Drupal's search URL looks like:
website.com/search/node/blahblah
And in .htaccess you could define:
RewriteRule ^search.php\?q=(.*)$ /search/node/$1 [R=301,NC,L]
Which would match the format of your legacy search URL, extract the query and rewrite the URL so that query is in Drupal's clean form. That way requests to website.com/search.php?q=blah get translated to website.com/search/node/blah before getting sent to Drupal. The user however will see the new, Drupal-style URL.
mod_rewrite is well documented.
This is of course going to be harder to do if your legacy URLs make use of unique IDs that do not exist in Drupal. In that case I'd take care to make sure that node IDs and taxonomy IDs etc all correspond between your legacy site and your new site. That way you could translate something like /view.php?articleID=121 to /node/121.
This has the effect of handling any incoming links from search engines, third party sites, or users' bookmarks, but leaves you with an entirely new URL structure. I've used this approach before when migrating to Drupal.