I have Google'ed long for this but can't find an answer.
I have this URL:
www.mysite.com/index.php?tip=1
(respectively www.mysite.com/?tip=1)
And want it to rewrite to:
www.mysite.com/tip/1
Your help would be appreciated.
You will need to enable rewrite module in your apache config and put the following settings on the .htaccess file your base folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^tip/(.*) /index.php?tip=$1 [L,NC,QSA]
Related
i am trying to run my project on client's server with the following url:
http://quotes.simplybridal.com/simply-bridal-backend/login // It Gives 404 Not Found Error
But it works for:
http://quotes.simplybridal.com/simply-bridal-backend/public/index.php/login // It works
now, my question is how can we remove this index.php from the url.
here is my .htaccess file content, which i placed outside /public folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /simply-bridal-backend/
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Any help would be really appreciated.
Looks like an Apache issue.
Can you post your Virtual Host content (or .htaccess)?
Check your document root variable (that should be something like /foo/bar/public (with no trailing slash)
--
Put this default .htaccess and make sure the route exists and it is reachable.
Options -MultiViews
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
My url is http://example.com/index.php?pid=software_details&p=18 I want to change my url to http://example.com/software_details/18. I used .htaccess file to do this but it's not working... please someone help me! thanks in advance...!
My .htaccess code is as bellow:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/([^/]*)/([^/]*) /index.php?pid=$1&p=$2 [L]
</IfModule>
I think the rule below should achieve what you are looking for:
RewriteRule ^/(.*)/(.*)$ /index.php?pid=$1&p=$2 [R=301,L]
at this site:
http://www.syriadailynews.com/sdn/
I used codeigniter with segment based url
and it works fine at localhost (xampp)
but after uploded the site, all urls not working
this is my .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
AddDefaultCharset UTF-8
I edit config.php to this:
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
It's worked now ! ^_^
I have this in my .htaccess file:
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
I want to redirect the url /sale to the new one /gift-sales So I have added this to the above:
RewriteCond %(THE-REQUEST)^sale$
RewriteRule ^(.*)$ /gift-sales [R=30,L]
In the ModX backend I have, of course, changed the alias to gift-sales, but I cannot seem to get the redirect working. Can anyone point me in the right direction?
try this:
RewriteRule ^/sale http://www.mydomain.com/gift-sales [R=301,L]
I think I can use the .htaccess file for this, but I've looked it up and not found anything useful. What I want to do is have my site redirect to a php page when a user types their username in the URL like:
example.com/username
And have it be the same as a PHP page like:
example.com/name.php?id=username
I'd like it to display as example.com/username even after it redirects, but it is not necessary. Any ideas?
You can use mod_rewrite to transparently rewrite your URLs on the server.
Assuming that you'd only have usernames following your domain, something like this would do what you want:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .+ name.php?id=$0
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) users.php?user=$1 [L]
I think that will work.
The Apache mod_rewrite guide is here
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
You probably want Apache's mod_rewrite.