URL rewriting is not working on live server in php - php

I have a URL that looks like:
DomainName/admin_panel/messages.php?order_id=7&to_id=7
I want to convert this URL to:
DomainName/admin_panel/messages
I have create a .htaccess file like below but it's not working on live server as well as on localhost. URL remains the same.. Check the .htaccess file below..
RewriteEngine On
RewriteBase /
RewriteRule ^messages/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ messages.php?order_id=$1&to_id=$2 [NC,L]
Kindly help me. The website is hosted on Dreamhost. Thanks in advance..

Related

.htaccess URL Rewrite Error - The requested URL was not found on this server

I have a very simple rewrite rule. My entire .htaccess file is as follows:
RewriteEngine On
RewriteRule ^login/([a-zA-Z0-9-/]+)$ company-page.php?company_url=$1
RewriteRule ^login/([a-zA-Z0-9-/]+)/$ company-page.php?company_url=$1
This is perfectly run on locally Wamp server but not working on online server. It display following error.!
The requested URL /EZsample/login/mereco-technologies/ was not found on this server.
Can anyone help me!
if you are using a VPS please use this article,
1.Make sure u have enabled Mod_Rewrite ?
2.Made the changes in the virtual host configurations
https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite
This line of code helped me solve a very similar issue:
Options -MultiViews

htaccess working locally but not working on life servers

I tried .htaccess on my local server (localhost) and it's working well.
But when upload this code to life server not working ... i don't know why ?!!
This is the content of .htaccess file
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^home/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9]+)/?$ home.php?country=$1&name=$2&listingId=$3 [NC,L]
the expected that url work ... it's work on localhost only ... but on live server it's give me 404 notFound
MY-DOMAIN.COM/home/USA/David/1234
My live server is www.000webhost.com
have you tried to follow the advice given by your hoster and put RewriteBase / at the top of the .htaccess file?
see http://www.000webhost.com/faq.php?ID=16

Codeigniter not working properly when hosted

I had developed a website using Codeigniter. It was working good in localhost. When i hosted it and clicked on links i get "Internal Server Error".
Also i'm not able to see .htaccess files. Please tell me what i'm missing.
Works perfectly
Localhost:
$config['base_url'] = 'http://localhost/site/';
Welcome
When clicked above link, it goes to below url and works perfectly
http://localhost/site/welcome/page
Hosted
Public Web Server (Error):
$config['base_url'] = 'http://www.mysite.com/';
Welcome
When clicked above link, it goes to below url and gives an error
http://mysite.com/welcome/page
If you have access to the Apache error logs check those for why you are getting the 'Internal Server Error.'
On a Linux server those are usually found in '/var/log/apache2/error.log.'
On a Windows server they can by default be found in something like 'C:\Program Files\Apache\logs.' Or you can find out the location by looking in the conf file or virtual hosts conf file if you use that.
try
Welcome
see docs http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html
OR to hide index.php
add .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

htaccess rewrite on localhost

I have a problem with my .htaccess file, my problem is I have site on localhost and path to it is:
localhost/site/sitename/html/login.php?ref=company
and after uploading to server would be:
www.site-name.com/login.php?ref=asdas
What I needd to do is rewrite ref to looks like this (in both cases):
path_to_site/company/login.php
where company is
$_GET['ref']
For ex. I have this url:
localhost/site/sitename/html/login.php?ref=cola
And I want have this:
localhost/site/sitename/html/cola/login.php
How to do it?
Try this if it works for you:
RewriteCond %{HTTP_HOST} ^(.*)/$login.php$
RewriteRule ^(.*)$ http://www.site-name.com$1 [R=301,L]
I hope I understood what you want correctly. Also check if you have everything enabled and configured on your server correctly.
Look # http://httpd.apache.org/docs/current/mod/mod_rewrite.html for more information if youre using Apache.

IIS7 Rewrite Rules?

I'm used to making .htaccess rewriterules for PHP sites. But now I'm trying to do it with IIS7 which is totally new for me.
What I would like is when I insert the url with the page afterwards (www.website.ext/page), that it looks for the page www.website.ext/index.php?page=title.
In .htaccess it would be something like:
RewriteRule ^(.*)$ index.php?page=$1
But how can I do this in IIS7?
Thanks in advance!
I think that is not possible without plugins.
We bought this one few years ago http://www.helicontech.com/isapi_rewrite/ for mod_rewrite
Then you can upload your .htaccess file like on apache server.

Categories