I want this URL:
http://www.mydomainblabla.com/games_index_files.html
to be rewritten to this one:
http://www.mydomainblabla.com/gamesindexfiles.html
What modifications should I make to my .htaccess to make this work?
Related
i have a couple of unwanted urls that i want to redirect:
/faq/
/faq/question/1-title
/faq/question/2-title
I want all the /faq/question/* urls to redirect to /faq, is that possible?
I have this but this doesnt work :
RedirectMatch 301 ^/faq/question/([^/]+)/?$ /faq
With your shown samples/attempts, please try following htaccess rules file. Make sure you are putting this new rule at top of your htaccess file(after https rules(to change http --> https rules) in case there are any present in your htaccess file).
Also make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
##Put your new rule here..
RewriteRule ^faq/question/ /faq? [R=301,L,NC]
###Make sure to keep rest of your urls here onwards...
I have to made some changes in my htaccess if it is possible,
There is my htaccess:
RewriteRule ^blog/([a-zA-Z0-9.\/\-\?\&]+)/.php$ blog.php?id=$1
It is rewrite for get method wich one hide ?id= and it's work perfectly, so i have problem if i take of from url slash (/) then i get 404 erorr.
I need to made RewriteRull which one make slash on end of url if is url without slash.
So if is possible to make some if statement which one detect url without slash and add it. Or make RewriteRull for that url?
Adding this to your .htaccess file may just what you want:
DirectorySlash On
I need to create a rewrite rule for the following URL and I need to pass "id" and widget with the GET superglobal
http://www.domain.com/index.php?id=1866&widget=Dangerfield
Is it possible to only use the widget parameter & value in the re-written URL and still be just as functional, and if so, how?
Simple you'd add this to your .htaccess
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?id=$1&widget=$2 [L]
The original URL:
http://www.domain.com/index.php?id=1866&widget=Dangerfield
The rewritten URL:
http://www.domain.com/1866/Dangerfield.html
This is search engine friendly, your pages would be easily SEOed in search engines with a .html extension. It's better than having parameter at the end of the url which isn't seo friendly.
Steering assistance subdomain
The original URL:
http://domain.com/index.php?cat=cats&id=12&url=stackoverflow
The rewritten URL:
http://cats.domain.com/12/stackoverflow.html
Code to rewrite rule for above in .htaccess
i have to redirect one url to another. http://www.abc.com/realestate/ to Redirect to http://www.abc.com/businessfinder/company/4105/Property_Agent/. is it better to change on the codeigniter routes.php or the .htaccess file?
If you know that a URL should be redirected then there is no reason to hand the request to PHP. So, redirecting using the .htaccess file would be preferable.
If you have mod_alias installed then you can use the Redirect directive:
Redirect 301 /realestate/ http://www.abc.com/businessfinder/company/4105/Property_Agent/
You can also use mod_rewrite to jump between places in various ways. E.g.:
RewriteRule ^/realestate/?$ /businessfinder/company/4105/Property_Agent/ [R=301,L]
If that is not possible then you can use CodeIgniter's $this->url->redirect() method. It will send the user to any website you like.
I am reworking my website, going to be renaming a lot of directories, and need a simple way to write my .htaccess redirects for all of those pages. I am hoping for a solution that does not include a very long list of files. My .htaccess file is huge as it is.
You can use mod_alias or mod_rewrite for your redirecting. mod_rewrite works with regular expressions and mod_alias can work on both regular expression and path prefixes.
Here are some examples for when you want to rewrite /foo/… to /bar/…:
# mod_alias
# path prefix
Redirect 301 /foo /bar
# regular expression
RedirectMatch 301 ^/foo/(.*) /bar/$1
# mod_rewrite
RewriteEngine on
RewriteRule ^foo/(.*) /bar/$1 [L,R=301]
Note that mod_alias and mod_rewrite have different requirements for their regular expressions patterns. mod_alias does always require the full URL path. But with mod_rewrite it depends on whether you use it in a .htaccess file or in the server configuration/virtual host section. In a .htaccess file, you need to write the pattern without the per-directory path prefix (in case of the document root just /, in case of /quux/ it’s /quux/).