How to do url routing in joomla 2.5? - php

I am trying to make a website with joomla 2.5.
Now I want to do something that the urls do not change at all.
I mean that I want that the browser address bar just show the name of the site in all of the pages.
Is there any extensions for it?
EDIT
Now my urls look like the following:
mysite.com/component/k2/66-n-t-shirt-49-detail?Itemid=0
and I want it to be like this:
mysite.com/t-shirt1
Is it possible to change it from htaccess file?
I have changed the htaccess.txt to .htaccess too but it didn't work and it just removed index.php from the url.

Wrap your site in an iframe or frameset, that will only show the frameset url.
Else you could change all the urls to post, but this will require quite an effort in jQuery and would be quite hard.

Related

Change wordpress post url (remove subdomain)

I have a Wordpress blog installed in a subfolder and I would like to replace a part of the url of the post.
Right now it is like this: http://domain.com/wordpress/{permalink-structure}
What I would like to achieve (without moving the site) is: http://domain.com/{permalink-structure}
I tried changing the site url (and followed the instructions provided by WP on how to do this), but if I do this, my front-end stops working ( I am not retrieving the posts etc through the WP-API and I work with AngularJS)
Is there an easy way to automatically modify the (by wordpress generated) url of all future posts by using a plugin or modifying the source code? Or via .htaccess?
Redirecting via htaccess is my preferred option but when I tried this, the wp-api plugin (accessible via domain.com/wordpress/wp-json/* stopped working
Just to be clear: I am not accessing the posts by the generated URLS, I retrieve them via the API and the only thing I want is that the link object in the retrieved post has a different URL.
I don't know. Just try to help. This is my solution redirect what need to redirect.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wordpress/wp-json/(.*)$ http://domain.com/wordpress/wp-json/$1 [R=301,NC,L]
RewriteRule ^wordpress/(.*)$ /$1 [R=301,NC,L]
you want to change wordpress domain or URL. you need to perform following steps.
1 you need to modify all url's stored in database. I prefer to use https://interconnectit.com/ tool. It is pretty good and easy.
2 Once you update all database urls then you need to login in wp-admin and just update permalink settings.
you need to check plugins too. Some plugins may get deactivated you need to activate them again.
Hope this will help.
check word press codex:
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
you can display your word press without move your directory from sub folder to root folder and can remove sub-directory from URL.

URL Rewrite Issue for Print button

I have a website which is developed using Joomla. I am using Joomla's Default URL rewriting option.
On one page I have this URL before SEF enable.
index.php?option=com_osproperty&task=property_details&id=19
after SEF Enabled it becomes..
component/osproperty/?no_html=1
I want to skip this URL to become SEO Friendly. Because due to this, I am not able to use print functionality.
The router.php file for your com_osproperty is not properly written to address print links. You will need to fix that file. Take a look at how the com_content router is written.

Permalinks to dynamic generated content

On this project I am working on, there is a portfolio and a project page.
The project page is dynamically generated using PHP, and I am trying to find a way to create a permalink to these generated pages.
So on the Portfolio page there will be entries that when clicked, it will take you to the generated project page following a template with static links (i.e. menu links, style-sheet links etc...).
So what is the best way to do this / to link to the generated content?
Note: I have tried re-write rules in htaccess but these don't seem to work.
Something like this?
http://www.website.com/index.php?id=abc
Then in PHP do this...
<?php
$id = $_GET['id'];
//do whatever you want with the id
//to add more variables to the URL use &anothervariable=abc
?>
Rewrite rules are to make the URL look more appealing, like...
http://www.website.com/p/abc
EDIT:
Make sure that you have mod_rewrite installed in Apache
Then in .htaccess...
RewriteEngine on
RewriteRule ^php/project/([a-zA-Z0-9_-]+)$ php/project.php?project=$1

joomla fully customize component link

I made a component and now I want to customize the link for it.
I already wrote the router.php.
The link to the component view (if I use the JRoute function of course) now looks good, except for the first part, which looks like :
http://www.example.com/en/component/componentname/...
don't mind the "en", it's there cause I use JomFish to manage more languages on my site.
I want to transform "/component/componentname/" to "/myString/" for example.
I can't use the menu for this, cause my site displays info from a database, linking this many sites to my menu is impossible.
The only solution I found requires the changing of the Joomla JRoute function (I found only a suggestion, not how it's done :( ).
What about using mod_rewrite to rewrite your url?
Basically you put the rewrite rules into your .htaccess file and Apache will handle the rest.
There is a great guide that teaches you all about it on http://www.htmlist.com/how-to/a-simplemod_rewrite-tutorial/

Changing WordPress URL structure while maintaing the proper 301 redirects with mod_rewrite

I currently have a blog set up with WordPress using URLs like so:
www.domain.com/blog/?pid=384092817
This was before I knew anything about anything. There's a significant amount of content there now and I want to change my URL structure to:
www.domain.com/my-post-title-384092817
Is there a way to set up my .htaccess and mod rewrite so when users go to the first url they get a 301 redirect to the second URL? I know to change my WordPress address (URL) setting from www.domain.com/blog to www.domain.com and my permalink setting to /%postname%-%post_id%, but how do I tell the old URLs to redirect to the new ones?
Do you actually mean that when users go to the second URL, it will be rewritten to the first? That can be done with
RewriteRule /blog/.+-(\d+)$ /blog/?pid=$1
If you want to send 301 redirects from the old URLs to the new ones, then you can't really do that with an .htaccess file. The reason is that Apache's mod_rewrite doesn't have access to the title of your post, so it won't know what title to insert in the URL. You'd have to do that redirect with PHP.
EDIT: y'know what, actually that's not entirely true. You can do some pretty crazy things with the RewriteMap directive, such as instructing Apache to ask an arbitrary program to perform the rewriting, and in that way you could have, say, a PHP script that does some database work to figure out what the title is and rewrites the URL appropriately based on that. But that seems like a way overcomplicated solution and I wouldn't suggest doing it - it'll be much cleaner and easier to just send the redirect directly from PHP.
Depending on your WP version, you can just use the Permalink redirect plugin -- should do the trick for you within WordPress and without mod_rewrite. However, as of WordPress 2.3, a lot of this should work automatically. At that point, the only thing you should have to do is redirect all your /blog/... requests to the route, which you can do via mod_rewrite roughly like this:
RewriteRule ^blog(.*) $1 [QSA]

Categories