I just re-writed using htaccess ( with that I just removed the index.php part )
I just got a URL like this
http://localhost/mvc/movies/movie/3237-Movie-name-here
where
mvc - this root folder
movies - controller
movie - view
3237- Query string for getting from DB ( pk)
Movie-name - for SEO URL
with this I can get the movie details with pk 3237
Now I just need to rewrite this url to ( using htaccess )
http://localhost/mvc/movie/3237-Movie-name-here
Please help
Thanks
You can use CODEIGNITER Routing. Described in here http://codeigniter.com/user_guide/general/routing.html
In your case $route['mvc/movies/([:num)/(:any)'] = "mvc/movie/$1-$2";
Related
There's a site that has had a bunch of bad links indexed and I've been asked to deal with it. There's one type of link that is giving me a headache:
http://www.example.com/category-display.html&Category_Code=some_cat_code
I tried redirecting to the home page:
Redirect 301 /category-display.html& /
That doesn't work because it adds everything past the & to the url.
In the best of worlds, I'd like to redirect to:
/app/mm.mvc?Category_Code=some_cate_code
So I tried using querystring and RewriteRule/RewriteCond but there's no query string without the ? that I can figure out, so I'm kind of stuck here.
Any ideas?
You can use this rule as your top rule in site root .htaccess:
RewriteEngine On
RewriteRule ^category-display\.html&(.*)$ /app/mm.mvc?$1 [L,NC,NE,R=301]
I am developing a site and the products displayed on site contains url like
product details page -->
mysite.com/jeans/details.php?id=1
I want to convert it to
mysite.com/jeans/details.php?slug.php
slug = new-jeans-america
I want to convert it to
mysite.com/jeans/details.php?new-jeans-america.php
How can I do this ?? Can anyone suggest an htaccess rewrite code ?
I am really new to htaccess .
I need to know if there is a way to redirect long URLs to short URLs.
I have an RSS page that will list out a number of news items from my website. The URL format of each item (as per MySQL query) is something like http://example.com/news.php?id=2.
On my news.php (after being redirected to the news page upon clicking on any news title on the RSS page), there are parameters set to carry along the IDs which looks like http://example.com/news.php?news=2&view=1&topic=12.
For SEO purpose, I need to erase that dirty query string so that viewers will only see http://example.com/news.php?id=2 while on the server-side, it actually reads http://example.com/news.php?news=2&view=1&topic=12.
I had created an .htaccess file and it is placed inside the rss folder (where the rss.php file is located ) and tried several attempts but to no available.
Help me on this.
Here's what I would do:
RewriteEngine on
# id + view + topic
# http://www.domain.com/news/1/1/12 will load: /news.php?news=1&view=1&topic=12
RewriteRule ^news/([0-9]+)/([0-9]+)/([0-9]+)(/?)$ /news.php?news=$1&view=$2&topic=$3 [QSA,L,NC]
Please this .htaccess in the root folder.
Should the parameters be assigned to ($1,$2,$3...etc) instead?
RewriteRule ^news(/?)$ /news.php?news=$1&view=$2&topic=$3 [QSA,L,NC]
I am trying to rewrite my url for generating the seo friendly url. My original url is something like
video_play.php?cat=1?author=3?video=4
where
"cat=1" is represents my category and 1 is id of my category name like song,movie etc..
"author=3" 3 is the id of singer.
"video=4" 4 is the id of track being played currently...
I want to make this url some thing like video_play/song/artistname/songtitle.html
I am trying this code in .htaccess if any one can help me.. Thanks in advance...
RewriteRule /author/(.*)/cate/(.*) video_play.php?author=$1&cate=$2
Try this instead:
RewriteRule /author/([^\.]*)/cate/([^\.]*) video_play.php?author=$1&cate=$2
I am converting a static HTML website to a CMS.
The images folder is conflicting with a category name.
So, I would like to redirect all images in HOWTO directory like :
http://yourdomain.com/howto/images/someimage.jpg
to something like :
http://yourdomain.com/howto_imgs/images/someimage.jpg
I only want to change the image location and redirect old image URL links so they are displayed.
Any help would be much appreciated.
RewriteRule ^howto/images/(.*)$ howto_imgs/images/$1 [R=301,L]