.htaccess rewrite getting url not found - php

I am trying to rewrite URL's using .htaccess methods. This is working on localhost when XAMPP is used, but when I put it on the server it just doesn't.
Here is an example of the code used:
RewriteEngine On
Options +FollowSymLinks
Options -Indexes
DirectorySlash Off
RewriteRule ^contacts?$ contacts.php
RewriteRule ^example?$ tester.php?number=1
RewriteRule ^anotherexample?$ tester.php?number=2
I get this error message:
The requested URL /AMENPTHOME/hostnd/b/5/6/b56a95b8c/www/htdocs/public/new/produto_individual.php was not found on this server.
Can someone help?

Related

Htaccess rewrite working but without query string

I have a simple rewrite that works on localhost but not on my server. I'm trying to rewrite
www.website.com/arrangements/garden
to
www.website.com/arrangements.php?link=garden
and the code I have is
RewriteEngine On
RewriteRule ^arrangements/(.*)/?$ arrangements.php?link=$1 [NC,L]
But what I get on the server is only arrangements.php. The query string link is not present. I've tried everything I could think of and contacted hosting support as well, they got nothing.
Any ideas?
Use this,
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^arrangements/(.*) arrangements.php?link=$1 [L]

PHP Url Rewrite mod-rewrite

(Referring to http://www.webconfs.com/url-rewriting-tool.php -- using url http://mywebsite.com/urltest/product.php?categoryid=1&productid=10)
Enabled Apache Module -- Rewite_Module
I have created a page product.php
Write the code so that - it shows the content - when i request the page as:
http://mywebsite.com/urltest/product.php?categoryid=1&productid=10
Then I created .htaccess in my project root (that is, in /urltest/)
and added the following code to it:
Options +FollowSymLinks
RewriteEngine on
RewriteRule product/categoryid/(.)/productid/(.)/ product.php?categoryid=$1&productid=$2
RewriteRule product/categoryid/(.)/productid/(.) product.php?categoryid=$1&productid=$2
But, when I take: http://mywebsite.com/urltest/product/categoryid/1/productid/10/
I get the error:
Not Found
The requested URL /urltest/product/categoryid/1/productid/10/ was not found on this server.
(As I mentioned direct url, works fine - http://mywebsite.com/urltest/product.php?categoryid=1&productid=10)
Pl help
You have a rewrite base problem.
Have your code like this
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /urltest/
RewriteRule ^product/categoryid/([^/]+)/productid/([^/]+)/?$ product.php?categoryid=$1&productid=$2 [L]

404 Error in htaccess clean url

I have a website but i am getting 404 error while using clean url for my post URL
.htaccess code is
RewriteEngine On
RewriteRule ^post/([^/.]+)/?$ post.php?post=$1 [L]
RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L]
Files in Server is like :
index.php
post.php
.htaccess
all in one main public_html folder
this URL is working fine http://www.example.com/1
but i have 404 error in http://www.example.com/post/12345
i don't know what's problem... plz tell me what to do
Try turning off multiviews by adding this somewhere in your htaccess file:
Options -Multiviews

mod re write help - WAMP

Looking to re write a url in WAMP. I have AllowOverride Al (conf file). The mod rewrite modules is loaded. I am working on localhost
What i want to acheive is that on login the user gets redirected
localhost/propcms/xxxxxxx/
the actual address is
localhost/propcms/status.php?id=xxxxxxx
the .htaccess file has the following (and is located in localhost/propcms/ )
Options +FollowSymlinks
RewriteEngine on
RewriteBase /propcms/
RewriteRule ^propcms/([^/]*)/$ /propcms/status.php?id=$1 [L]
this is what i get....The requested URL /propcms/test121/ was not found on this server.
any ideas ??
Since you are specifying a rewritebase, you should not include it in your rewrite rule:
Try this snippet :
Options +FollowSymlinks
RewriteEngine on
RewriteBase /propcms/
RewriteRule ^([^/]*)/$ /propcms/status.php?id=$1 [L]

Friendly URLs cannot load ABS_PATH in OSClass

I have a friendly URL module redirecting my index page to a search page. If I write index.php with my link then it redirects me to index page. If I try to access registration page it gives me error
ABS_PATH is not loaded. Direct access is not allowed.
If I try to access any category it gives me an error such as
Not Found
The requested URL /for-sale_1/toys-games-hobbies_1/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I have checked my error log it is giving me this error
<IfModule mod_rewrite.c> is without </Ifmodule>
Works great on the local server, but not on the remove live using Apache.
Category links work on the live site but when I click to register or login or publish link it gives the error:
ABS_PATH is not loaded. Direct access is not allowed.
Here is the rule for register that is defined in generate_rules.php
$rewrite->addRule('^user/register$', 'index.php?page=register&action=register');
define('REL_WEB_URL', '/home/xxx/public_html');
define('WEB_PATH', 'xxx.com/';);
You should disable MultiViews option. Write the following line in your .htaccess file (it should be in the root folder of your OSClass installation):
Options -MultiViews
Moreover, you should make sure that the .htaccess file exists.
Try disabling negotiation module of apache or disabled MultiViews directive in server's configuration and/or .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Options -MultiViews
</IfModule>
create .htaccess file , copy root folder working!

Categories