sauravrawal Posted April 4, 2010 Share Posted April 4, 2010 i want to rewrite the url as following ? http://hamroworld.com/mypage into http://hamroworld.com/profile.php?profile=mypage For example: if someone enters http://hamroworld.com/mypage he/she should get the content of hamroworld.com/profile.php?profile=mypage How to do this ?please help me here I have headache because of this ! Quote Link to comment Share on other sites More sharing options...
Byron Posted April 4, 2010 Share Posted April 4, 2010 You can do that at your cpanel. Just look for the link that says Redirects. It should write something like this into your htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^hamroworld.com$ [OR] RewriteCond %{HTTP_HOST} ^www.hamroworld.com$ RewriteRule ^mypage$ "http\:\/\/profile\.php\?profile\=mypage" [R=301,L] Quote Link to comment Share on other sites More sharing options...
sauravrawal Posted April 5, 2010 Author Share Posted April 5, 2010 You can do that at your cpanel. Just look for the link that says Redirects. It should write something like this into your htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^hamroworld.com$ [OR] RewriteCond %{HTTP_HOST} ^www.hamroworld.com$ RewriteRule ^mypage$ "http\:\/\/profile\.php\?profile\=mypage" [R=301,L] Thanks but i want to rewrite hamroworld.com/anyvariable to hamroword.com/profile.php?profile=anyvariable It is not only 'mypage' I waiting for your help again Quote Link to comment Share on other sites More sharing options...
Byron Posted April 5, 2010 Share Posted April 5, 2010 I'm not to good with regex so if no one answers your question here you can make a post in this forum under "Apache configuration" http://www.codingforums.com/ I'm sure somebody there can help you. Quote Link to comment Share on other sites More sharing options...
DamegedSpy Posted April 6, 2010 Share Posted April 6, 2010 Had you done the PHP File? It should be simple: $_GET['page'] And querying the db for the contents. Just watch out for vulnerabilities. You can always learn PHP at http://w3schools.com After checking the website, do you mean more like restricting the pages to friends? Quote Link to comment Share on other sites More sharing options...
sauravrawal Posted April 7, 2010 Author Share Posted April 7, 2010 Had you done the PHP File? It should be simple: $_GET['page'] And querying the db for the contents. Just watch out for vulnerabilities. You can always learn PHP at http://w3schools.com After checking the website, do you mean more like restricting the pages to friends? Everything done only .htaccess remaining to work for me! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.