Current location: Hot Scripts Forums » Other Discussions » Web Servers » Change to custom URL


Change to custom URL

Reply
  #1 (permalink)  
Old 03-22-11, 09:42 AM
klauzer klauzer is offline
Newbie Coder
 
Join Date: Mar 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Change to custom URL

I don't know if this is the right forum to ask this. It is about a plugin that I am using in Wordpress.

But my problem is that I need to change my url from
Code:
/wp-login.php?action=register
to
Code:
/become-member/
I got info that I need to use .htaccess file MOD Rewrite and some L parameter.

As this is some coding here I thought that this forum will be the right place.
How do I start?
Reply With Quote
  #2 (permalink)  
Old 03-22-11, 10:13 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Code:
RewriteEngine On
RewriteRule ^become/member/$ /wp-login.php?action=register
Save this as ".htaccess" in your root directory and see what happens.
Reply With Quote
  #3 (permalink)  
Old 03-23-11, 06:07 AM
klauzer klauzer is offline
Newbie Coder
 
Join Date: Mar 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Nico

When trying to creat new file named .htaccess in my root directory it says that this file already exist. But I can't find it.

How should I solve this?
Reply With Quote
  #4 (permalink)  
Old 03-23-11, 06:22 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
The file may be hidden.

You could SSH into your server and create a backup of the original file:
Code:
sudo cp .htaccess .htaccess_old
... and then overwrite it with the new one.

Or you could do:
Code:
vi .htaccess
... and add these lines to the file.

If you're not too comfortable with the command line/terminal, you could see if your FTP client has an option to see hidden files.
Reply With Quote
  #5 (permalink)  
Old 03-23-11, 08:16 AM
klauzer klauzer is offline
Newbie Coder
 
Join Date: Mar 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I finally found .htaccess

This is what includes there.

Quote:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

RewriteEngine On
RewriteRule ^become/member/$ /wp-login.php?action=register

# END WordPress
Should I remove something? And where should I add
Quote:
RewriteEngine On
RewriteRule ^become/member/$ /wp-login.php?action=register
could I have
Quote:
/become-member/
instead of
Quote:
/become/member/
Thanks agian
Reply With Quote
  #6 (permalink)  
Old 03-23-11, 10:11 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Yeah, that should work. Give it a try and see what happens.
Reply With Quote
  #7 (permalink)  
Old 03-23-11, 03:23 PM
klauzer klauzer is offline
Newbie Coder
 
Join Date: Mar 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I have added it now and it looks like this
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteEngine On
RewriteRule ^become-member/$ /wp-login.php?action=register
</IfModule>

# END WordPress
But nothing happens. What did I wrong?
Reply With Quote
  #8 (permalink)  
Old 03-23-11, 06:04 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Hm, try this.

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^become-member/$ /wp-login.php?action=register
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Reply With Quote
  #9 (permalink)  
Old 03-24-11, 02:09 AM
klauzer klauzer is offline
Newbie Coder
 
Join Date: Mar 2010
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I tried so and I got Error 404 - Not Found

I have moved around this
Code:
RewriteRule ^become-member/$ /wp-login.php?action=register
and nothing happens. Did I missed something?
Reply With Quote
  #10 (permalink)  
Old 03-24-11, 03:17 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Hm, it should work.

Are you sure you're not missing the slash when inserting the URL into your address bar?

Do your other (rewritten) Wordpress URLs work? Perhaps your server doesn't have mod_rewrite at all?
Reply With Quote
Reply

Bookmarks


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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
using mod_rewrite - url change problem windstory Web Servers 0 03-28-09 01:51 PM
Change url Deansatch JavaScript 1 12-08-07 03:33 AM
Change this AJAX script to accomidate dynamic url arandlett JavaScript 3 06-14-06 03:01 AM
change IE search URL or change window registry sma JavaScript 1 04-26-04 02:40 PM
change IE search URL or change window registry sma PHP 0 04-26-04 05:38 AM


All times are GMT -5. The time now is 01:30 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.