need help
i have a link like this
http://www.mysite.com/obj/task/land/city/41277/landId/19/Best+Restaurant//Sville%20city
using htaccess
RewriteRule ^l/([0-9]+)/([0-9]+)/?$ index.php?obj=obj&task=land&city=$1&landId=$2
RewriteRule ^l/([0-9]+)/([0-9]+)$ index.php?obj=obj&task=land&city=$1&landId=$2
now my link looks like this
http://www.mysite.com/l/41277/19
what should i add on my htaccess so that my link like this will be accepted
http://www.mysite.com/l/41277/19/Best+Restaurant//Sville%20city
http://www.mysite.com/l/41247/17/Best+parks/Cold%20Province/Platinum%20city
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 /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^l/([0-9]+)/([0-9]+)/? /index.php?obj=obj&task=land&city=$1&landId=$2 [L,QSA,NC]
Related
I wrote this code into my .htaccess file, but it seems not to work.
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^([^/]*)\.html$ /category/test.php?name=$1 [L]
When writing http://example.com/z.html it automatically redirects me to 404 file.
Do you have any suggestions?
Make sure you have mod_rewrite enabled and try your rules this way.
Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.html$ /category/test.php?name=$1 [L]
This url
example.com/ad/load.php?id=pay.jpg
would become
example.com/ad/pay.jpg
I tried to do this.. but it doesn't work.
Here is my htaccess (into ad folder)
Options +FollowSymLinks
RewriteEngine On
RewriteBase /ad/
RewriteRule ^(\w+) ./load.php?id=$1
Edit
on this root example.com/ad/ I want to show index.php but it does not show. how to fix it
You regex should allow dot also. Try this in /ad/.htaccess:
DirectoryIndex index.php
Options +FollowSymLinks
RewriteEngine On
RewriteBase /ad/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([\w.-]+)/?$ load.php?id=$1 [L,QSA]
I have a site that redirects from www.page.com/timmy to www.page.com/
I would like to redirect www.page.com/timmy to www.page.com/#timmy
How would I do this?
I would like to redirect www.page.com/timmy to www.page.com/#timmy
You may try this in one .htaccess file at root directory:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^timmy /#timmy [L,NC,NE]
For permanent redirection, replace [L,NC,NE] with [R=301,L,NC,NE]
How to redirect
/Search?Keyword=vehicles
to
/Search.php?Keyword=vehicles
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 /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,NC,QSA]
I'm trying to redirect users with htaccess. I want to redirect any wildcard subfolder to the index with subfolder as a php variable.
Example:
http://domain.com/abc
Change to:
http://domain.com/index.php?x=abc
I'm pretty sure I can do this is htaccess although I'm not 100%. Thanks!
This should be easy, use this code:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?x=$1 [L,QSA]
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^abc /kat.php?index.php?x=abc [L]
############ or dynamic
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.+) /kat.php?index.php?x=$1 [L]