mod re write help - WAMP - php

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]

Related

.htaccess rewrite getting url not found

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?

.htaccess rewriterule for directory doesn't seem to work only for subdomains

My website has main domain & subdomains which has htaccess rewrite issue,
my issue is, there is htaccess code under www.example.com,
RewriteBase /
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^?]*).html$ content.php?pid=$1
When i create content page with url path www.example.com/test.html or www.example.com/folder/test.html it works absolutely fine.
But i have same code on my subdomain & the 'folder' url doesn't work. I mean subdomain.example.com/test.html works fine but subdomain.example.com/folder/test.html doesn't seem to work.
Thanks a lot in advance.. :) Please help...
Can you try this code in your subdomain .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /subdomain/
RewriteRule ^([^.]+)\.html$ subdomaincontent.php?pid=$1 [L,NC,QSA]
Make sure there is no other .htaccess below subdomain.

Hide a part of a URL with mod_rewrite but keep the argument

I would like to write a rule where the members/show/ string will be hidden in the URL.
The original URL: localhost:8080/sandbox/member/show/helloworld, where helloworld is the name of the account. I'd like it to be localhost:8080/sandbox/m/helloworld. Basically, the content delivered will be from the full url, but I'd like it to be hidden for any user.
RewriteRule ^.*$ member/show/$0 [L,QSA] doesn't seem to work, it throws a 500 Internal Server Error. I work with the CodeIgniter Framework, and the following rewrite rule is already present: RewriteRule .* index.php/$0 [PT,L].
I tried several RewriteRule options but without success. I'd be very glad if anyone could shed some light related to my question.
Best regards.
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(sandbox)/m/([^/]+)/?$ /$1/member/show/$2 [L,NC]

.htaccess modrewrite not redirecting my links

I'm changing my website links to a SEO friendly urls, I did every thing in php file and changed the urls as following:
http://mywebsiet.com/news-details.php?id=2012/6/21/newstitle.html
how can I redirect to:
http://mywebsiet.com/2012/6/21/newstitle.html
I tried this Generating tool from www.generateit.net/mod-rewrite/
and created the .htaccess with the code provided:
RewriteEngine On
RewriteRule ^([^_]*)$ /news-details.php?id=$1 [L]
and even so, nothing get changed.... any ideas?
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(.+?\.html)$ /news-details.php?id=$1 [L,QSA,NC]

Create .htaccess Rewrite rule same as wordpress

I am Creating Rewrite Rule in .htaccess
I have some issue i am creating Rule like wordpress but i didnt get correctly
The Rule which i am writing is below
`RewriteRule projectDir/(.*)/(.*)/(.*)$ index.php?module=$1&action=$2&id=$3`
In this ReFacta is my Project Directory
The Url Which i want it same as like below
`http://localhost/projectDir/user/edit/5`
Any idea Friends ?
You are nearly correct. what is wrong in your code, you don't have specified RewriteBase
Options +FollowSymLinks
RewriteEngine on
RewriteBase /projectDir
RewriteRule ^(.*)/(.*)/(.*)$ /index.php?module=$1&action=$2&id=$3 [L]

Categories