Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 04-21-2012, 11:09 PM
Contributing Member
 
Join Date: 02-26-12
Posts: 110
iTrader: 0 / 0%
Question URL Rewrite Help

I have an article directory and want to rewrite its URL(Search Engine Friendly), how I an change them using .htaccess? my current URL structure is as follow:

Pages: domain .com/page.php?p=1 (change it to xyz.html etc)
Category: domain .com/category.php?id=1
Article: domain .com/article.php?id=1
Profile page: domain .com/profile.php?a=1

I will be happy to get help here
 
Reply With Quote
  #2 (permalink)  
Old 04-22-2012, 06:48 PM
Junior Member
 
Join Date: 04-16-12
Location: Winnipeg
Posts: 13
iTrader: 0 / 0%
You could give something like this a try. Replace MyPage with the name of the page you want it to appear as.
Let me know if it works.
Code:
RewriteEngine on RewriteRule MyPage(.*)\.html$ /page.php?p=$1

Last edited by RDS Hosting; 04-22-2012 at 06:53 PM.
 
Reply With Quote
  #3 (permalink)  
Old 04-22-2012, 09:59 PM
Contributing Member
 
Join Date: 02-26-12
Posts: 110
iTrader: 0 / 0%
Quote:
Originally Posted by RDS Hosting View Post
You could give something like this a try. Replace MyPage with the name of the page you want it to appear as.
Let me know if it works.
Code:
RewriteEngine on RewriteRule MyPage(.*)\.html$ /page.php?p=$1
I just tried this method:

RewriteEngine on
RewriteRule MyPage(.*)\.html$ /page.php?p=$1

but not working,

just did a URL redirect that is working:
rewritecond %{http_host} ^mydomain.com [nc]
rewriterule ^(.*)$ http://www.mydomain.com/$1 [r=301,nc]
 
Reply With Quote
  #4 (permalink)  
Old 07-17-2012, 04:21 AM
Member
Latest Blog:
None

 
Join Date: 07-12-12
Posts: 38
iTrader: 0 / 0%
to rewrite all the urls uniquely you need a lot of work and is not recommended, even you cant do that.

for example, if you want to rename profile urls than u have to manually specify what to use for each profile number.

there is one solution like you can specify in ur rewrite code to use page title instead of number (for your articles)
similarly for profiles,etc.

But the most easy and least time consuming method will be to edit your template or theme or script , whatever you are using.

you can hire a professional for this in just 5$ on fiverr

let me know if you need further help.
 
Reply With Quote
  #5 (permalink)  
Old 07-17-2012, 10:21 PM
Member
Latest Blog:
None

 
Join Date: 07-16-12
Posts: 39
iTrader: 0 / 0%
If you are looking for the examples of URL rewriting then this code might be useful for you

Code:
1)Rewriting product.php?id=12 to product-12.html It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL. RewriteEngine on RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1 2) Rewriting product.php?id=12 to product/ipod-nano/12.html SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL. RewriteEngine on RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
 
Reply With Quote
  #6 (permalink)  
Old 08-08-2012, 10:47 PM
Junior Member
 
Join Date: 09-15-11
Posts: 6
iTrader: 0 / 0%
I am trying to convert from wordpress. Is there a permalink structure that can change the links like bravocharlii said.
 
Reply With Quote
  #7 (permalink)  
Old 08-09-2012, 08:04 AM
snakeair's Avatar
Super Moderator
 
Join Date: 12-31-07
Location: Medford, NJ
Posts: 42,162
iTrader: 3 / 100%
Quote:
Originally Posted by Emmett View Post
I am trying to convert from wordpress. Is there a permalink structure that can change the links like bravocharlii said.
For self hosted WordPress blog you can change the permalink in your admin settings.

Go to admin dashboard and click on "settings" then click on "permalinks"

Also see this link below before changing anything.

http://codex.wordpress.org/Using_Permalinks
__________________
Newbiz Advertising - A resourceful blog

Like us on Facebook: facebook.com/Newbizshop

Premium WordPress Themes - A list of themes.
 
Reply With Quote
  #8 (permalink)  
Old 08-09-2012, 08:51 AM
freeadstime's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 07-09-12
Posts: 332
iTrader: 0 / 0%
This may help you as well.
http://www.adamwhippy.com/my-work/se...ordpress-urls/
__________________
We make sure that everyone has access to a Free Ads classifieds. Post an Ad under pets, vehicles, services, jobs, apartment rentals and other similar categories.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod Rewrite Help? Bart Coding Forum 3 11-12-2009 11:57 AM
Mod Rewrite help Jamz Coding Forum 10 10-28-2009 04:25 AM
i want to rewrite url like this great_friend Coding Forum 5 10-23-2008 09:39 AM
Mod Rewrite Help...please DM_Web _Directory Coding Forum 16 04-11-2007 06:43 PM
How to do rewrite like v7n Antonio Coding Forum 3 04-01-2006 03:19 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 05:50 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.