I want to access movies.php?m=Bengali Audio but in this format movies/Bengali Audio i write these .htaccess code but its showing File not found, where movies.php?m=Bengali Audiois working fine
RewriteEngine On
# Rewrite for movies.php?m=Bengali Audio
RewriteRule ^movies/([0-9a-zA-Z_-]+'')$ movies.php?m=$1 [NC,L]
You can use this regex pattern to match spaces in movie name:
Options -MultiViews
RewriteEngine On
# Rewrite for movies.php?m=Bengali Audio
RewriteRule ^movies/([^/]+)/?$ movies.php?m=$1 [NC,L,QSA]
Related
I would like to redirect all URLs ending in
data.html to templates/data.php
info.html to templates/info.php
any_other_file.html to templates/index.php
Again, all URLs ending with those names (could be http://some-domain.com/some/long/path/data.html)
You can use this in your /.htaccess file:
RewriteEngine On
# Internally rewrite data/info.html to the applicable PHP file
# in the templates directory
RewriteRule (data|info).html$ /templates/$1.php [NC,L]
# Rewrite everything else ending in .html to /templates/index.php
RewriteRule ^(.*).html$ /templates/index.php [NC,L]
I have a URL:
www.example.com/property-listings/united-states/colorado/denver/denver-co-office-space
I want to stay on the same page above but simply display the URL in the address bar like this:
www.example.com/property-listings/united-states/colorado/denver/office-space
How do I accomplish this using htaccess and rewrite rules?
If I understood right, try writing a rule like this one:
RewriteEngine on
RewriteRule property-listings/united-states/colorado/denver/office-space http://www.example.com/property-listings/united-states/colorado/denver/denver-co-office-space [L]
OK. You didn't supply a pattern or mentioned there was any, so I have to guess the pattern is up to /denver/ subdirectory. Try this:
RewriteEngine on
RewriteRule ^(property-listings/united-states/colorado/denver/)(office-space)/?$ $1denver-co-$2 [L]
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 ^(property-listings/united-states/colorado)/(denver)/(office-space)/?$ $1/$2/$2-co-$3 [L,NC]
I'm trying to make the following redirection (301) using .htaccess for mp3, jpg, jpeg, png & gif files only.
http://website.com/file.jpg?c=XXXX is replaced with http://website.com/file.jpg
Basically, I want to strip the query (ie. "?c=XXXX") from end of media url's. I want to prevent anyone accessing an image or mp3 with "?c=XXXX" at the end of the URL, and instead direct them to the same file url minus '?c=XXXX'.
Is there a quick way of doing this?
Many thanks!
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 %{QUERY_STRING} !^$
RewriteRule \.(mp3|jpe?g|png|gif)$ %{REQUEST_URI}? [L,R]
Could you please help to do a one off redirect in htaccess file from:
/something-something-something-something-c-2_19_70.html
to this type of file that does not have the number -2_:
/something-something-something-something-c-19_70.html
I am sure there is a short code that will get applied to all url of that type
Thank you very much in advance
David
Put this code in your .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
# redirect /something-something-something-something-c-2_19_70.html
# to /something-something-something-something-c-19_70.html
RewriteRule ^(.*)2_(.*)$ $1$2 [L,NC,R]
# redirect /ethical-jewellery-silver-c-2_19.html to /silver-c-19.html
RewriteRule ^[^-]+-[^-]+-([^-]+-)([^-]+-)2_(.*)$ $1$2$3 [L,NC,R]
Ok I have a script in the folder 'intake'. The index.php file auto creates a list of urls. Those urls are in the format:
/intake/4/Westrop
I have an .htaccess file in the intake folder. I want it to redirect the url to a FILE.
The above example would then become /intake/redirect.php?id=4&name=Westrop
Here's what I have so far:
DirectoryIndex index.php
Options All -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/(.*)$ /intake/redirect.php?id=$1&name=$2 [L]
</IfModule>
But for some reason if I type /intake or /intake/index.php I get a 404 error. According to firebug its trying to take "intake" and turn it into "intake.php"
Any ideas?
Place the following code in .htaccess file in website root folder:
RewriteEngine On
RewriteRule ^intake/(\d+)/([a-z0-9\-_]+)$ /intake/redirect.php?id=$1&name=$2 [NC,QSA,L]
P.S.
Do not use this sort of pattern -- ^(.*)/(.*)$ -- in your case for longer URLs it will work not as you would expect. It will match your URL .. but in a wrong way.
Start your .htaccess with this option:
Options +All -MultiViews -Indexes