I am using Yii framework to develop my website. I didn't activate any URL manager in my main.php file and every thing is working fine with the default url structure. But now i want get the data of user from the below url manner
www.projectname.com/username.
But as per the current url structure, i am unable to get the data and it is showing requested url not found on this server.
When I type www.projectname.com/index.php/username then it is working but users will not enter index.php and it is not good manner as i know.
So can anyone please guide me to get the data when the user enter the url like
www.projectname.com/username
If your Username Controller Then
Use This In your config main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<username>' => 'user/profile',
You need to remove index.php from the url. You can follow this link to learn how to do it.
Related
I'm using an Typo3 new updated website 9.5.9, www.mywebsite.com/mypage1 url generate a 404 page, but when i try this www.mywebsite.com/mypage1?no_cache=1 is working.
I have already tried empty cache.
I also tried upgrading from 9.5.7 tp 9.5.9.
Code error is : 404 Not Found.
Any body have some idea ?
Thanks!
Either the Site Configuration is wrong or not set. Check the Base URL .
Or your URL Slug of that page is different than you expected. Maybe TYPO3 added a "1" at the end of the URL Slug, because that excact URL Slug is already being used somewhere in the Database (See Tables "pages", Field "slug"). If you need it to be that excact URL Slug, then delete the wrong page in the database and after that recreate the URL Slug in the page settings.
The server admin have found the problem, it was from nginx server configuration under etx/nginx i don't know what he really changed but it is not a typo3 problem.
Thank you for your reply!
I am able to reach my website at a certain ip address and I am going to implement a REST service. I have some PHP files that perform actions on a database and I am calling them from the client. I am using linux ubuntu as server and so far I can do this:
http://xxx.xxx.xxx.xxx/api/create/?id=someId&val=someValue
http://xxx.xxx.xxx.xxx/api/delete/?id=someId
I can do the above because inside /var/www/html I have a folder called api that contains another folder called create. The create cointains the file index.php so that I can omit it and execute the URL you can see above.
This works fine but I don't think this is the proper way to do it. I am new with this so I don't know what to do. After some researches I have found that my goal probably be achieved using an .htaccess file use url rewriting but I am not sure.
How can I do this? Do I have to place all the php files in a single folder and then use an htaccess file? (^)
(^) To be more precise: instead of having this
http://xxx.xxx.xxx.xxx/api/create/index.php?id=someId&val=someValue
http://xxx.xxx.xxx.xxx/api/delete/index.php?id=someId
//and so on with other actions...
Do I have to create a folder like
http://xxx.xxx.xxx.xxx/files/
containing all my php files (create.php, delete.php, view.php...) and the use an htaccess to redirect?
I see that websites offer their api using www.domain.com/api/something/?data=Value or www.domain.com/api/something/dataAbout/. Are they doing what I have said about the .htaccess? I hope I have well explained my problem.
htaccess:
RewriteEngine On
RewriteRule ^api/([\w-]+)/?$ files/$1.php [L,NC]
This is inside /var/www/html and I have api inside /home/username/api .
Thanks Emma
Do it like this:
Create php files in a folder files/ subdirectory as create.php, delete.php, view.php etc (by renaming each individual index.php file, you mentioned).
Move away api directory somewhere outside site root.
Once that is done use following .htaccess file in /var/www/html/:
RewriteEngine On
RewriteRule ^api/([\w-]+)/?$ files/$1.php [L,NC]
Then use new URLs as:
http://xxx.xxx.xxx.xxx/api/create?id=someId&val=someValue
http://xxx.xxx.xxx.xxx/api/delete?id=someId
In first, this is not the right way to create a RESTFUL API. My suggestion is to you read a best practices article.
You shouldn't create a CREATE and DELETE folder. You should use HTTP actions.
To create a new record you should use POST. In example, POST /user and in the body you pass the user's information.
In another example, you could use the same route by using different HTTP methods: DELETE /user/1 to delete a user and PATCH /user/1 to edit some already existent user's information.
Hope it's help you.
I want to show this following url but when I try to show it, it goes to authentication page while if you copy and paste this url in your browser it will show the requested page without authentication.
I am using phpdesigner and easyphp in which I confront this problem. I try using file_get_content, curl_init, ... but still can't show the following url.
Thanks in advance.
http://sepehrreservation.iranhrc.ir/Systems/FA/Reservation/Flight_NewReservation_Search.aspx?itinerary=THR|MHD|2017-02-28|
I made an application in Joomla 3. Had a custom component in front end, which showing the details of a selected category.
Which the URL with out enable search engine friendly and URL rewrite as follows
wwww.sitename.com/index.php?option=com_arts&view=category&id=12
So I enabled the URL rewrite, SEO URL and URL suffix
http://www.sitename.com/component/arts/12.html?view=category
But I am trying to get a URL like this
http://www.sitename.com/caterory/12
I generated the link to this page using
<?php echo JRoute::_('index.php?Itemid=115&id='.$cat->id); ?>
Can anyone please help
Thanks in advance
To make the SEF router do what you want it to do, you have write your own router. You cannot, however, get rid of the component part of the URL.
Do do that, you do not need your own router, but a menu entry for each category. That menu does not have to be displayed, if you don't want to show it. The alias of that menu entry is then used for the SEF URL.
I think, this is what you are looking for
Supporting SEF URLs in your custom component
sef urls for custom component, which variant is better?
I want to Install a drupal website on the server in a subdirectory to use some of it's features for my main website, I dont want the installation affect the current website in any way.
the actual reason for doing this is that for example I would be able to use news section of drupal for main website.
so for instance, I install drupal on "drupal" subdirectory like www.mydomain.com/drupal , then when I configure and run the news section it will be like www.mydomain.com/drupal/news, what I want is when a user goes to www.mydomain.com/news, it loads www.mydomain.com/drupal/news instead.
I'd really appreciate any proper approach and suggestions to achieve this.
If I correctly understand your question that you want to have URLs like:
http://example.com/news/headline-test
But using Drupal's URL http://example.com/drupal/news/headline-test to provide the content of the first URL, you should use Apache rewrites.
Here is an example:
Add this to your top .htaccess folder (http://example.com/.htaccess - not publicly accessible yes):
RewriteEngine on
RewriteRule ^news/(.*) drupal/news/$1
See the Apache rewrite document for more examples/help.
Drupal cannot take over any folder if there is another file exists or it's pointing to another folder. But in this case, both of your http://example.com/drupal/news/headline-test and http://example.com/news/headline-test URLs will show the same content.
Do not edit Drupal's $base_url setting. Let Drupal figure it out. Also, add some robots.txt disallows to prevent content duplication. Block drupal's native URLs.
Take a look at redirect module.
OR
Create a custom module with hook_menu implementation
function MY_MODULE_menu()
{
$items = array();
$items['news'] = array(
'title' => 'news redirect',
'type' => MENU_CALLBACK,
'access callback' => TRUE,
'page callback' => 'drupal_goto',
'page arguments' => array('drupal/news'),
);
return $items;
}